Options
All
  • Public
  • Public/Protected
  • All
Menu

Class G2

The G2 class represents a multivector for a 2-dimensional vector space with a Euclidean metric.

The G2 class is immutable, making it easy to reason about values.

The G2 class supports units of measures.

The immutable nature of the

G2

makes it less suitable for high performance graphics applications.

Hierarchy

  • G2

Implements

Index

Constructors

constructor

  • new G2(α?: number, x?: number, y?: number, β?: number, uom?: Unit): G2
  • Parameters

    • Default value α: number = 0
    • Default value x: number = 0
    • Default value y: number = 0
    • Default value β: number = 0
    • Optional uom: Unit

    Returns G2

Properties

Private _coords

_coords: number[] = [0, 0, 0, 0]

The coordinate values are stored in a number array. This should be convenient and efficient for tensor calculations.

property

_coords

uom

uom: Unit
property

uom

Static Private _I

_I: G2 = new G2(0, 0, 0, 1)
property

_I

static

Static Private _e1

_e1: G2 = new G2(0, 1, 0, 0)
property

_e2

static

Static Private _e2

_e2: G2 = new G2(0, 0, 1, 0)
property

_e2

static

Static Private _one

_one: G2 = new G2(1, 0, 0, 0)
property

_one

static

Static Private _zero

_zero: G2 = new G2(0, 0, 0, 0)
property

_zero

static

Static ampere

ampere: G2 = new G2(1, 0, 0, 0, Unit.AMPERE)

Static candela

candela: G2 = new G2(1, 0, 0, 0, Unit.CANDELA)

Static coulomb

coulomb: G2 = new G2(1, 0, 0, 0, Unit.COULOMB)

Static kelvin

kelvin: G2 = new G2(1, 0, 0, 0, Unit.KELVIN)

Static kilogram

kilogram: G2 = new G2(1, 0, 0, 0, Unit.KILOGRAM)

Static meter

meter: G2 = new G2(1, 0, 0, 0, Unit.METER)

Static mole

mole: G2 = new G2(1, 0, 0, 0, Unit.MOLE)

Static second

second: G2 = new G2(1, 0, 0, 0, Unit.SECOND)

Accessors

a

  • get a(): number
  • set a(unused: number): void

b

  • get b(): number
  • set b(unused: number): void

coords

  • get coords(): number[]

x

  • get x(): number
  • set x(unused: number): void
  • The coordinate corresponding to the e1 basis vector, without the unit of measure.

    property

    x

    readonly

    Returns number

  • The coordinate corresponding to the e1 basis vector, without the unit of measure.

    property

    x

    readonly

    Parameters

    • unused: number

    Returns void

y

  • get y(): number
  • set y(unused: number): void
  • The coordinate corresponding to the e2 basis vector, without the unit of measure.

    property

    y

    readonly

    Returns number

  • The coordinate corresponding to the e2 basis vector, without the unit of measure.

    property

    y

    readonly

    Parameters

    • unused: number

    Returns void

Static I

  • get I(): G2
  • set I(unused: G2): void

Static e1

  • get e1(): G2
  • set e1(unused: G2): void

Static e2

  • get e2(): G2
  • set e2(unused: G2): void

Static one

  • get one(): G2
  • set one(unused: G2): void

Static zero

  • get zero(): G2
  • set zero(unused: G2): void

Methods

__add__

  • __add__(other: any): G2

__bang__

  • __bang__(): G2

__div__

  • __div__(other: any): G2

__eq__

  • __eq__(rhs: G2): boolean

__ge__

  • __ge__(rhs: G2): boolean

__gt__

  • __gt__(rhs: G2): boolean

__le__

  • __le__(rhs: G2): boolean

__lshift__

  • __lshift__(other: any): G2

__lt__

  • __lt__(rhs: G2): boolean

__mul__

  • __mul__(other: any): G2

__ne__

  • __ne__(rhs: G2): boolean

__neg__

  • __neg__(): G2

__pos__

  • __pos__(): G2

__radd__

  • __radd__(other: any): G2

__rdiv__

  • __rdiv__(other: number | G2): G2

__rlshift__

  • __rlshift__(other: any): G2

__rmul__

  • __rmul__(other: any): G2

__rrshift__

  • __rrshift__(other: any): G2

__rshift__

  • __rshift__(other: any): G2

__rsub__

__rvbar__

  • __rvbar__(other: any): G2

__rwedge__

  • __rwedge__(other: any): G2

__sub__

__tilde__

  • __tilde__(): G2

__vbar__

  • __vbar__(other: any): G2

__wedge__

  • __wedge__(other: any): G2

add

addPseudo

addScalar

adj

  • adj(): G2

angle

  • angle(): G2

conj

  • conj(): G2

coordinate

  • coordinate(index: number): number

cos

  • cos(): G2

cosh

  • cosh(): G2

cubicBezier

direction

  • direction(): G2

distanceTo

div

divByScalar

  • divByScalar(α: number): G2

equals

exp

  • exp(): G2

ext

grade

  • grade(grade: number): G2

inv

  • inv(): G2

isNaN

  • isNaN(): boolean

isOne

  • isOne(): boolean

isScalar

  • isScalar(): boolean

isSpinor

  • isSpinor(): boolean

isZero

  • isZero(): boolean

lco

lerp

  • lerp(target: G2, α: number): G2

log

  • log(): G2

magnitude

  • magnitude(): G2

magnitudeSansUnits

  • magnitudeSansUnits(): number

mul

neg

  • neg(): G2

norm

  • norm(): G2

pow

  • pow(exponent: G2): G2

quad

  • quad(): G2

quadraticBezier

rco

reflect

rev

  • rev(): G2

rotate

scale

  • scale(α: number): G2

scp

sin

  • sin(): G2

sinh

  • sinh(): G2

slerp

  • slerp(target: G2, α: number): G2

squaredNorm

  • squaredNorm(): G2

squaredNormSansUnits

  • squaredNormSansUnits(): number

stress

sub

tan

  • tan(): G2

toExponential

  • toExponential(fractionDigits?: number): string

toFixed

  • toFixed(fractionDigits?: number): string

toPrecision

  • toPrecision(precision?: number): string

toString

  • toString(radix?: number): string

Private toStringCustom

  • toStringCustom(coordToString: (x: number) => string, labels: string[]): string
  • Parameters

    • coordToString: (x: number) => string
        • (x: number): string
        • Parameters

          • x: number

          Returns string

    • labels: string[]

    Returns string

toStringIJK

  • toStringIJK(): string

Static Private add

  • add(a: number[], b: number[]): number[]

Static copy

Static Private ext

  • ext(a: number[], b: number[]): number[]

Static fromCartesian

  • fromCartesian(α: number, x: number, y: number, β: number, uom: Unit): G2

Static fromVectorE2

Static Private lshift

  • lshift(a: number[], b: number[]): number[]

Static Private rshift

  • rshift(a: number[], b: number[]): number[]

Static Private sub

  • sub(a: number[], b: number[]): number[]

Static vector

  • vector(x: number, y: number, uom?: Unit): G2