Class Geometric3

Constructors

  • Constructs a Geometric3. The multivector is initialized to zero. coords [a, x, y, z, xy, yz, zx, b]

    Parameters

    • coords: [number, number, number, number, number, number, number, number] = ...

    Returns Geometric3

Properties

E1: Geometric3 = ...

The basis element corresponding to the vector x coordinate. The multivector is locked (immutable), but may be cloned.

E2: Geometric3 = ...

The basis element corresponding to the vector y coordinate. The multivector is locked (immutable), but may be cloned.

E3: Geometric3 = ...

The basis element corresponding to the vector z coordinate. The multivector is locked (immutable), but may be cloned.

ONE: Geometric3 = ...

The identity element for multiplication, 1. The multivector is locked (immutable), but may be cloned.

PSEUDO: Geometric3 = ...

The basis element corresponding to the pseudoscalar b coordinate. The multivector is locked (immutable), but may be cloned.

ZERO: Geometric3 = ...

The identity element for addition, 0. The multivector is locked.

Accessors

  • get maskG3(): number
  • A bitmask describing the grades.

    0x0 = zero 0x1 = scalar 0x2 = vector 0x4 = bivector 0x8 = pseudoscalar

    Returns number

Methods

  • Adds a multivector value to this multivector with optional scaling.

    this ⟼ this + M * alpha

    Parameters

    • M: GeometricE3

      The multivector to be added to this multivector.

    • alpha: number = 1

      An optional scale factor that multiplies the multivector argument.

    Returns Geometric3

    this + M * alpha

  • Copies the coordinate values into this Geometric3.

    Parameters

    • coordinates: number[]

      The coordinates in order a, x, y, z, yz, zx, xy, b.

    Returns this

  • Sets this multivector to the value of the scalar, α. The non-scalar components are set to zero.

    Parameters

    • α: number

      The scalar to be copied.

    Returns this

  • Copies the spinor argument value into this multivector. The non-spinor components are set to zero.

    Parameters

    • spinor: SpinorE3

      The spinor to be copied.

    Returns this

  • Copies the vector argument value into this multivector. The non-vector components are set to zero.

    Parameters

    • vector: VectorE3

      The vector to be copied.

    Returns this

  • this ⟼ this / magnitude(this)

    If the magnitude is zero (a null multivector), this multivector is unchanged. Since the metric is Euclidean, this will only happen if the multivector is also the zero multivector.

    Returns Geometric3

  • Sets this multivector to its reflection in the plane orthogonal to vector n.

    Mathematically,

    this ⟼ - n * this * n

    Geometrically,

    Reflects this multivector in the plane orthogonal to the unit vector, n.

    If n is not a unit vector then the result is scaled by n squared.

    Parameters

    • n: VectorE3

      The unit vector that defines the reflection plane.

    Returns Geometric3

  • Sets this multivector to a rotor that rotates through angle θ around the specified axis.

    Parameters

    • axis: VectorE3

      The (unit) vector defining the rotation direction.

    • θ: number

      The rotation angle in radians when the rotor is applied on both sides as R * M * ~R

    Returns this

  • Computes a rotor, R, from two unit vectors, where R = (|b||a| + b * a) / sqrt(2 * |b||a|(|b||a| + b << a))

    The result is independent of the magnitudes of a and b.

    Parameters

    Returns this

    The rotor representing a rotation from a to b.

  • Sets this multivector to a rotor that rotates through angle θ in the oriented plane defined by B.

    this ⟼ exp(- B * θ / 2) = cos(|B| * θ / 2) - B * sin(|B| * θ / 2) / |B|

    Parameters

    • B: BivectorE3

      The (unit) bivector generating the rotation.

    • θ: number

      The rotation angle in radians when the rotor is applied on both sides as R * M * ~R

    Returns this

  • squaredNorm(A) = |A||A| = A | ~A

    Returns the (squared) norm of this multivector.

    If this multivector is mutable (unlocked), then it is set to the squared norm of this multivector, and the return value is this multivector. If thus multivector is immutable (locked), then a new multivector is returned which is also immutable.

    this ⟼ squaredNorm(this) = scp(this, rev(this)) = this | ~this

    Returns Geometric3

    squaredNorm(this)

  • Returns a string representing the number in exponential notation.

    Parameters

    • OptionalfractionDigits: number

    Returns string

  • Returns a string representing the number in fixed-point notation.

    Parameters

    • OptionalfractionDigits: number

    Returns string

  • Returns a string representation of this multivector.

    Parameters

    • Optionalradix: number

    Returns string

  • Sets this multivector to the geometric product of the arguments. This multivector must be mutable (in the unlocked state).

    this ⟼ a * b

    Parameters

    • a: VectorE3

      The vector on the left of the operator.

    • b: VectorE3

      The vector on the right of the operator.

    Returns this

    the geometric product, a * b, of the vector arguments.