Hide menu
Loading...
Searching...
No Matches
XYZ

Implements 3D point interface and operations.

Implements

Constructors

new XYZ()

new XYZ(x?, y?, z?): XYZ

Parameters

x?

number

X coordinate of 3D point.

y?

number

Y coordinate of 3D point.

z?

number

Z coordinate of 3D point.

Returns

XYZ

Accessors

x

Get Signature

get x(): number

Returns x coordinate of 3D point.

Returns

number

Set Signature

set x(x): void

Sets x coordinate of 3D point.

Parameters

x

number

X coordinate.

Returns

void

X coordinate of 3D point.

Implementation of

BaseXYZ.x


y

Get Signature

get y(): number

Returns y coordinate of 3D point.

Returns

number

Set Signature

set y(y): void

Sets y coordinate of 3D point.

Parameters

y

number

Y coordinate.

Returns

void

Y coordinate of 3D point.

Implementation of

BaseXYZ.y


z

Get Signature

get z(): number

Returns z coordinate of 3D point.

Returns

number

Set Signature

set z(z): void

Sets z coordinate of 3D point.

Parameters

z

number

Z coordinate.

Returns

void

Z coordinate of 3D point.

Implementation of

BaseXYZ.z

Methods

add()

add(other): this

Adds other point coordinates to this point coordinates.

Parameters

other

XYZ

Other point.

Returns

this


added()

added(other): XYZ

Returns new XYZ object with coordinates received by performing a add() operation to this object.

Parameters

other

XYZ

Other point.

Returns

XYZ


angle()

angle(other): number

Returns angle between this and other points.

Parameters

other

XYZ

Other point.

Returns

number


clone()

clone(): XYZ

Creates new XYZ point with coordinates same as this.

Returns

XYZ


copy()

copy(other): this

Copies the coordinates of the other point to this.

Parameters

other

XYZ

Copied object.

Returns

this


cross()

cross(other): this

Sets coordinates of this point as cross product of this and other points.

Parameters

other

XYZ

Other point.

Returns

this


crossCross()

crossCross(coord1, coord2): this

Computes this = this.cross(coord1.cross(coord2)).

Parameters

coord1

XYZ

First point.

coord2

XYZ

Second point.

Returns

this


crossCrossed()

crossCrossed(coord1, coord2): XYZ

Returns new XYZ object with coordinates received by performing a crossCross() operation to this object.

Parameters

coord1

XYZ

First point.

coord2

XYZ

Second point.

Returns

XYZ


crossed()

crossed(other): XYZ

Returns new XYZ object with coordinates received by performing a cross() operation to this object.

Parameters

other

XYZ

Other point.

Returns

XYZ


divide()

divide(scalar): this

Divide this point coordinates by scalar value.

Parameters

scalar

number

Scalar value.

Returns

this


divided()

divided(scalar): XYZ

Returns new XYZ object with coordinates received by performing a divide() operation to this object.

Parameters

scalar

number

Scalar value.

Returns

XYZ


dot()

dot(other): number

Returns dot product of this and other points.

Parameters

other

XYZ

Other point.

Returns

number


get()

get(index): number

Returns coordinate value of 3D point:

  • X coordinate if index equals 0
  • Y coordinate if index equals 1
  • Z coordinate if index equals 2

Throws exception if index is not in range [0, 2].

Parameters

index

number

Coordinate index.

Returns

number


isEqual()

isEqual(other, tolerance): boolean

Returns true if other point coordinates are equal to this point coordinated within provided tolerance (1e-7 by default). Returns false otherwise.

Parameters

other

XYZ

Other 3D point.

tolerance

number = XYZ.coincidenceTolerance

Coordinates comparison tolerance;

Returns

boolean


isNormal()

isNormal(other, tolerance): boolean

Returns true if other point is perpendicular to this within provided tolerance (1e-7 by default).

Parameters

other

XYZ

Other point.

tolerance

number = XYZ.angularTolerance

Returns

boolean


isOpposite()

isOpposite(other, tolerance): boolean

Returns true if other point is opposite to this within provided tolerance (1e-7 by default).

Parameters

other

XYZ

Other point.

tolerance

number = XYZ.angularTolerance

Returns

boolean


isParallel()

isParallel(other, tolerance): boolean

Returns true if other point is parallel to this within provided tolerance (1e-7 by default).

Parameters

other

XYZ

Other point.

tolerance

number = XYZ.angularTolerance

Returns

boolean


modulus()

modulus(): number

Returns modulus of this point.

Returns

number


multiplied()

Call Signature

multiplied(other): XYZ

Returns new XYZ object with coordinates received by performing a multiply() operation to this object.

Parameters

other

XYZ

Other point.

Returns

XYZ

Call Signature

multiplied(matrix): XYZ

Returns new XYZ object with coordinates received by performing a multiply() operation to this object.

Parameters

matrix

Matrix3d

3D matrix.

Returns

XYZ

Call Signature

multiplied(scalar): XYZ

Returns new XYZ object with coordinates received by performing a multiply() operation to this object.

Parameters

scalar

number

Scalar value.

Returns

XYZ


multiply()

Call Signature

multiply(other): this

Multiplies this point coordinates with other point coordinates.

Parameters

other

XYZ

Other point.

Returns

this

Call Signature

multiply(matrix): this

Multiplies this point coordinates with 3D matrix.

Parameters

matrix

Matrix3d

3D matrix.

Returns

this

Call Signature

multiply(scalar): this

Multiplies this point coordinates with scalar value.

Parameters

scalar

number

Scalar value.

Returns

this


normalize()

normalize(): this

Normalizes coordinates of this point.

Returns

this


normalized()

normalized(): XYZ

Returns new XYZ object with normalized coordinates of this point.

Returns

XYZ


reverse()

reverse(): this

Reverses coordinates of this point.

Returns

this


reversed()

reversed(): XYZ

Returns new XYZ object with coordinates received by performing a reverse() operation to this object.

Returns

XYZ


set()

set(index, value): this

Sets coordinate value of 3D point:

  • X coordinate if index equals 0
  • Y coordinate if index equals 1
  • Z coordinate if index equals 2

Throws exception if index is not in range [0, 2].

Parameters

index

number

Coordinate index.

value

number

Coordinate value.

Returns

this


setCoord()

setCoord(x?, y?, z?): this

Sets x, y and z coordinates of this object.

Parameters

x?

number

X coordinate of 3D point.

y?

number

Y coordinate of 3D point.

z?

number

Z coordinate of 3D point.

Returns

this


setX()

setX(x): this

Sets x coordinate of 3D point.

Parameters

x

number

X coordinate.

Returns

this


setY()

setY(y): this

Sets y coordinate of 3D point.

Parameters

y

number

Y coordinate.

Returns

this


setZ()

setZ(z): this

Sets z coordinate of 3D point.

Parameters

z

number

Z coordinate.

Returns

this


subtract()

subtract(other): this

Subtracts other point coordinates from this point coordinates.

Parameters

other

XYZ

Other point.

Returns

this


subtracted()

subtracted(other): XYZ

Returns new XYZ object with coordinates received by performing a subtract() operation to this object.

Parameters

other

XYZ

Other point.

Returns

XYZ


toJSON()

toJSON(): BaseXYZ

Returns JSON representation of this point.

Returns

BaseXYZ


toString()

toString(precision): string

Returns string representation of this point with provided precision (3 by default).

Parameters

precision

number = 3

Precision.

Returns

string


fromXYZ()

static fromXYZ(xyz): XYZ

Creates new XYZ object from object implementing BaseXYZ interface.

Parameters

xyz

BaseXYZ

Object implementing BaseXYZ interface.

Returns

XYZ