Hide menu
Loading...
Searching...
No Matches
Axis1d

Defines an axis as a combination of point and direction.

Constructors

Constructor

new Axis1d(location?, direction?): Axis1d

Creates an axis.

If no arguments are provided, the axis is created at `Point.origin()` (that is, (0, 0, 0)) with `Direction.zDir()` (that is, (0, 0, 1)). The provided point and direction are copied, so later changes to the original objects do not affect this axis.

Parameters

location?

Point = ...

Location point of the axis.

direction?

Direction = ...

Direction of the axis.

Returns

Axis1d

Properties

direction

readonly direction: Direction

Direction of the axis.


location

readonly location: Point

Location point of the axis.

Methods

clone()

clone(): Axis1d

Creates a new axis with the same location and direction as this axis.

Returns

Axis1d


copy()

copy(other): this

Copies the location and direction of other to this axis.

The values of the point and direction are copied without replacing the existing location and direction objects of this axis.

Parameters

other

Axis1d

Axis to copy.

Returns

this


isCoaxial()

isCoaxial(other, angularTolerance?, distanceTolerance?, allowOpposite?): boolean

Returns true if other axis is coaxial to this axis.

Parameters

other

Axis1d

Other axis.

angularTolerance?

number = Axis1d.angularTolerance

Angular tolerance. Defaults to 1e-5.

distanceTolerance?

number = Axis1d.coincidenceTolerance

Distance tolerance. Defaults to 1e-7.

allowOpposite?

boolean = false

Whether opposite directions are allowed to be considered coaxial. Defaults to false.

Returns

boolean


mirror()

Call Signature

mirror(point): this

Mirrors this axis relative to a point.

Parameters

point

Point

Other point.

Returns

this

Call Signature

mirror(axis): this

Mirrors this axis relative to an axis.

Parameters

axis

Axis1d

Axis.

Returns

this

Call Signature

mirror(axis): this

Mirrors this axis relative to an axis.

Parameters

axis

Axis3d

Axis.

Returns

this


mirrored()

Call Signature

mirrored(point): Axis1d

Returns a new axis obtained by applying mirror() to this axis.

Parameters

point

Point

Point.

Returns

Axis1d

Call Signature

mirrored(axis): Axis1d

Returns a new axis obtained by applying mirror() to this axis.

Parameters

axis

Axis1d

Axis.

Returns

Axis1d

Call Signature

mirrored(axis): Axis1d

Returns a new axis obtained by applying mirror() to this axis.

Parameters

axis

Axis3d

Axis.

Returns

Axis1d


ox()

static ox(): Axis1d

Returns an OX axis.

The returned axis has location at `Point.origin()` (that is, (0, 0, 0)) and direction equal to `Direction.xDir()` (that is, (1, 0, 0)).

Returns

Axis1d


oy()

static oy(): Axis1d

Returns an OY axis.

The returned axis has location at `Point.origin()` (that is, (0, 0, 0)) and direction equal to `Direction.yDir()` (that is, (0, 1, 0)).

Returns

Axis1d


oz()

static oz(): Axis1d

Returns an OZ axis.

The returned axis has location at `Point.origin()` (that is, (0, 0, 0)) and direction equal to `Direction.zDir()` (that is, (0, 0, 1)).

Returns

Axis1d


reverse()

reverse(): this

Reverses the direction of this axis.

Returns

this


reversed()

reversed(): Axis1d

Returns a new axis with the direction obtained by applying reverse() to this axis.

Returns

Axis1d


rotate()

rotate(axis, angle): this

Rotates this axis around axis by angle.

Parameters

axis

Axis1d

Rotation axis.

angle

number

Rotation angle.

Returns

this


rotated()

rotated(axis, angle): Axis1d

Returns a new axis obtained by applying rotate() to this axis.

Parameters

axis

Axis1d

Rotation axis.

angle

number

Rotation angle.

Returns

Axis1d


scale()

scale(point, scale): this

Scales the location of this axis.

If scale is negative, the direction of the axis is reversed.

Parameters

point

Point

Other point.

scale

number

Scale value.

Returns

this


scaled()

scaled(point, scale): Axis1d

Returns a new axis with the location obtained by applying scale() to this axis.

Parameters

point

Point

Other point.

scale

number

Scale value.

Returns

Axis1d


transform()

transform(transformation): this

Transforms this axis according to transformation.

Parameters

transformation

Transformation

Transformation.

Returns

this


transformed()

transformed(transformation): Axis1d

Returns a new axis obtained by applying transform() to this axis.

Parameters

transformation

Transformation

Transformation.

Returns

Axis1d


translate()

translate(vector): this

Translates this axis.

Parameters

vector

Vector

Translation vector.

Returns

this


translated()

translated(vector): Axis1d

Returns a new axis obtained by applying translate() to this axis.

Parameters

vector

Vector

Translation vector.

Returns

Axis1d