Skip to content

Shapemetry API


Shapemetry API / Axes

Class: Axes

Defined in: core/Axes.ts:7

An orthonormal coordinate frame (origin + x/y/z unit axes) for local↔world transforms.

Constructors

Constructor

new Axes(origin, xAxis, yAxis, zAxis): Axes

Defined in: core/Axes.ts:8

Parameters

origin

Point

xAxis

Vector

yAxis

Vector

zAxis

Vector

Returns

Axes

Properties

origin

readonly origin: Point

Defined in: core/Axes.ts:9


xAxis

readonly xAxis: Vector

Defined in: core/Axes.ts:10


yAxis

readonly yAxis: Vector

Defined in: core/Axes.ts:11


zAxis

readonly zAxis: Vector

Defined in: core/Axes.ts:12

Methods

toJSON()

toJSON(): AxesJSON

Defined in: core/Axes.ts:15

Returns

AxesJSON


fromJSON()

static fromJSON(d): Axes

Defined in: core/Axes.ts:16

Parameters

d

AxesJSON

Returns

Axes


fromTransformation()

static fromTransformation(tr): Axes

Defined in: core/Axes.ts:18

Parameters

tr

Transformation

Returns

Axes


fromNormal()

static fromNormal(normal, origin?): Axes

Defined in: core/Axes.ts:29

Build a right-hand frame from a normal (zAxis = normal). Origin defaults to Point(0,0,0).

Parameters

normal

Vector

origin?

Point = ...

Returns

Axes


fromNormalAndRef()

static fromNormalAndRef(normal, refDir, origin?): Axes

Defined in: core/Axes.ts:47

Build a right-hand frame from a normal and a reference direction (xAxis projected from refDir).

Parameters

normal

Vector

refDir

Vector

origin?

Point = ...

Returns

Axes


fromTangent()

static fromTangent(origin, tangent): Axes

Defined in: core/Axes.ts:66

Build a right-hand frame from a tangent (xAxis = tangent). Picks an arbitrary stable normal.

Parameters

origin

Point

tangent

Vector

Returns

Axes


rotate()

rotate(axis, angle): Axes

Defined in: core/Axes.ts:79

Rotate all 3 axes around a unit axis. Origin unchanged.

Parameters

axis

Vector

angle

number

Returns

Axes


withOrigin()

withOrigin(origin): Axes

Defined in: core/Axes.ts:84

Return a copy with the origin replaced.

Parameters

origin

Point

Returns

Axes


toTransformation()

toTransformation(): Transformation

Defined in: core/Axes.ts:88

Returns

Transformation