Class G20

A multivector for two dimensions with a Euclidean metric.

Constructors

  • Parameters

    • x: number = 0
    • y: number = 0
    • a: number = 0
    • b: number = 0

    Returns G20

Properties

change$: Observable<G20> = ...
ex: G20 = ...
ey: G20 = ...
I: G20 = ...
one: G20 = ...
zero: G20 = ...

Accessors

Methods

  • Adds a multiple of a scalar to this multivector.

    Parameters

    • a: number

      The scalar value to be added to this multivector.

    • α: number = 1

      The fraction of (a * uom) to be added. Default is 1.

    Returns G20

    this + (a * uom) * α

  • A convenience function for set(0, 0, 0, 0). Requires this multivector to be mutable.

    Returns this

  • A convenience function for set(mv.x, mv.y, mv.a, mv.b). Requires this multivector to be mutable.

    Parameters

    • mv: Readonly<G20>

    Returns this

  • A convenience function for set(0, 0, spinor.a, spinor.b). Requires this multivector to be mutable.

    Parameters

    Returns this

  • A convenience function for set(vector.x, vector.y, 0, 0). Requires this multivector to be mutable.

    Parameters

    Returns this

  • Parameters

    • v: G20
    • Optionaleps: number

    Returns boolean

  • Computes the right inverse of this multivector. inv(X) satisfies X * inv(X) = 1.

    Returns G20

    inverse(this)

  • Determines whether this multivector is locked. If the multivector is in the unlocked state then it is mutable. If the multivector is in the locked state then it is immutable.

    Returns boolean

  • Determines whether this multivector is exactly 0 (zero).

    Parameters

    • Optionaleps: number

    Returns boolean

  • Locks this multivector (preventing any further mutation), and returns a token that may be used to unlock it.

    Returns number

  • If this is mutable, then sets this multivector to its reflection in the plane orthogonal to vector n. The result is mutable. If this is immutable (locked), a copy of this is made, which is then reflected. The result is immutable (locked).

    i.e. The result is mutable (unlocked) iff this is mutable (unlocked).

    Mathematically,

    this ⟼ - n * this * n

    Geometrically,

    Reflects this multivector in the plane orthogonal to the unit vector, n. This implementation does assume that n is a vector, but does not assume that it is normalized to unity.

    If n is not a unit vector then the result is scaled by n squared. The scalar component gets an extra minus sign. The pseudoscalar component does not change sign. The units of measure are carried through but in most cases n SHOULD be dimensionless.

    Parameters

    • n: Readonly<Vector>

      The unit vector that defines the reflection plane.

    Returns G20

  • reverse has a ++-- structure on the grades. The scalar component, a, will not change. The vector components, x and y, will not change. The bivector component, b, will change sign.

    Returns G20

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

    Parameters

    • θ: number

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

    Returns G20

  • 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

    • a: Readonly<Vector>

      The starting vector

    • b: Readonly<Vector>

      The ending vector

    Returns G20

    The rotor representing a rotation from a to b.

  • R = sqrt(|b|/|a|) * (|b||a| + b * a) / sqrt(2 * |b||a|(|b||a| + b << a))

    The result is depends on the magnitudes of a and b.

    Parameters

    Returns G20

  • Sets the coordinates of this multivector. Requires this multivector to be mutable.

    Parameters

    • x: number

      The coordinate along the x-axis.

    • y: number

      The coordinate along the y-axis.

    • a: number = 0

      The scalar coordinate.

    • b: number = 0

      The bivector coordinate.

    Returns this

  • Subtracts a multiple of a scalar from this multivector.

    Parameters

    • a: number

      The scalar value to be subtracted from this multivector.

    • α: number = 1

      The fraction of (a * uom) to be subtracted. Default is 1.

    Returns G20

    this - (a * uom) * α

  • Unlocks this multivector (allowing mutation), using a token that was obtained from a preceding lock method call.

    Parameters

    • token: number

    Returns this

  • this ⟼ a * b

    Sets this Geometric2 to the geometric product a * b of the vector arguments.

    Parameters

    Returns G20

  • Parameters

    • v1: Readonly<G20>
    • v2: Readonly<G20>

    Returns number