clifford.tools.classify

Tools for interpreting conformal blades

clifford.tools.classify.classify(x)clifford.tools.classify.Blade[source]

Classify a conformal multivector into a parameterized geometric description.

The multivector should be from a ConformalLayout, such as the one returned by clifford.conformalize().

Implemented based on the approach described in table 14.1 of Geometric Algebra for Computer Science (Revised Edition).

Example usage:

>>> from clifford.g3c import *

>>> classify(e1)
DualFlat[1](flat=Plane(direction=-(1.0^e23), location=0))

>>> classify(einf)
InfinitePoint(direction=1.0)

>>> classify(up(e1))
Point(direction=1.0, location=(1.0^e1))

>>> classify(up(3*e1)^up(4*e2))
PointPair(direction=-(3.0^e1) + (4.0^e2), location=(1.5^e1) + (2.0^e2), radius=2.5)

>>> classify(up(e1)^up(e2)^up(e1+2*e2))
Circle(direction=-(2.0^e12), location=(1.0^e1) + (1.0^e2), radius=1.0)

>>> classify(up(e1)^up(e2)^up(e1+2*e2)^einf)
Plane(direction=-(2.0^e12), location=0)

>>> classify(up(e1)^e2)
Tangent[2](direction=(1.0^e2), location=(1.0^e1))

# how the inheritance works
>>> Point.mro()  
[Point, Tangent[1], Round[1], Blade[1], Tangent, Round, Blade, object]

The reverse of this operation is Blade.mv.

The return type is a Blade:

class clifford.tools.classify.Blade(layout)[source]

Base class for providing interpretation of blades.

Note that thanks to the unual metaclass, this class and its subclasses are have grade-specific specializations, eg Blade[2] is a type for blades of grade 2.

layout

The layout to which this blade belongs

Type

Layout

property mv

Convert this back into its GA representation

The subclasses below are the four categories to which all blades belong, where \(E\) is a euclidean blade, and \(T_p[X]\) represents a translation of the conformal blade \(X\) by the euclidean vector \(p\).

class clifford.tools.classify.Direction(direction)[source]

\(En_\infty\)

direction

The euclidean direction, \(E\)

Type

MultiVector

class clifford.tools.classify.Flat(direction, location)[source]

\(T_p[n_o \wedge (En_\infty)]\)

direction

The euclidean direction, \(E\)

Type

MultiVector

location

The closest point on this flat to the origin, \(p\), as a euclidean vector.

Type

MultiVector

class clifford.tools.classify.DualFlat(flat)[source]

Dual of Flat

flat

The flat this is the dual of

Type

Flat

class clifford.tools.classify.Round(direction, location, radius)[source]

\(T_p[(n_o + \frac{1}{2}\rho^2 n_\infty)E]\)

direction

The euclidean direction, \(E\)

Type

MultiVector

location

The euclidean center, \(p\)

Type

MultiVector

radius

The radius, \(\rho\), which may be imaginary

Type

float or complex

These can be constructed directly, and will attempt to show a grade-specific interpretation:

>>> from clifford.g3c import *
>>> Round(location=e1, direction=e1^e2, radius=1)
Circle(direction=(1^e12), location=(1^e1), radius=1)
>>> Round(direction=e1^e2^e3, location=e1, radius=1)
Sphere(direction=(1^e123), location=(1^e1), radius=1)

Aliased types

In addition, aliases are created for specific grades of the above types, with more convenient names:

class clifford.tools.classify.Tangent(direction, location)[source]

Bases: clifford.tools.classify.Round

A Round of radius 0, \(T_p[n_o E]\)

class clifford.tools.classify.Point(direction, location)[source]

Bases: clifford.tools.classify.Tangent[1]

A conformal point, \(A\)

class clifford.tools.classify.PointFlat(direction, location)[source]

Bases: clifford.tools.classify.Flat[2]

A flat point, \(A \wedge n_\infty\)

class clifford.tools.classify.Line(direction, location)[source]

Bases: clifford.tools.classify.Flat[3]

A line, \(A \wedge B \wedge n_\infty\)

class clifford.tools.classify.Plane(direction, location)[source]

Bases: clifford.tools.classify.Flat[4]

A line, \(A \wedge B \wedge C \wedge n_\infty\)

class clifford.tools.classify.PointPair(direction, location, radius)[source]

Bases: clifford.tools.classify.Round[2]

A point pair, \(A \wedge B\)

class clifford.tools.classify.Circle(direction, location, radius)[source]

Bases: clifford.tools.classify.Round[3]

A circle, \(A \wedge B \wedge C\)

class clifford.tools.classify.Sphere(direction, location, radius)[source]

Bases: clifford.tools.classify.Round[4]

A sphere, \(A \wedge B \wedge C \wedge D\)

class clifford.tools.classify.InfinitePoint(direction)[source]

Bases: clifford.tools.classify.Direction[1]

A scalar multiple of \(n_\infty\)