Point3

class Point3()

Constructors

Properties


Constructors

Point3.constructor(x, y, z)
Arguments:
  • x (number()) – X value
  • y (number()) – Y value
  • z (number()) – Z value

Creates a new point object.

Return type:Point3

Properties

Point3.x
Type:number
Point3.y
Type:number
Point3.z
Type:number

Methods

static add

Point3.add(p1, p2)
Arguments:

Adds two points.

Returns:Sum of p1 and p2.
Return type:Point3

assign

Point3.assign(point)
Arguments:

Sets this point equal to another point.

Returns:This point object.
Return type:this

copy

Point3.copy()

Creates a copy of this point.

Returns:Copy of this point object.
Return type:Point3

equals

Point3.equals(other)
Arguments:
  • other (IPoint3()) – Point to compare with.

Strictly compares this point with another.

Returns:True if the values of this point equal those of the other.
Return type:boolean

equalsWithTolerance

Point3.equalsWithTolerance(other, tolerance)
Arguments:
  • other (IPoint3()) – Point to compare with.
  • tolerance (number()) – Tolerance to be used in the comparison.

Compares this point with another using a tolerance.

Returns:True if the values of this point equal those of the other.
Return type:boolean

fromArray

Point3.fromArray(arr)
Arguments:
  • arr ([number]()) – Array to assign from.

Sets this point from an array.

Returns:This point object.
Return type:this

isAxis

Point3.isAxis()

Returns a boolean value indicating if this vector lies on a major axis.

Return type:boolean

length

Point3.length()

Returns the length of this vector.

Returns:Vector length.
Return type:number

negate

Point3.negate()

Negates the point.

Returns:This object.
Return type:this

static normalize

Point3.normalize(v)
Arguments:

Normalize a vector.

Returns:A vector that is colinear to v with a length of 1.
Return type:Point3

static scale

Point3.scale(p, k)
Arguments:
  • p (IPoint3()) – None
  • k (number()) – Constant value to scale byS

Scale a point by a constant factor

Returns:Copy of p scaled by a constant factor
Return type:Point3

set

Point3.set(x, y, z)
Arguments:
  • x (number()) – X value to set.
  • y (number()) – Y value to set.
  • z (number()) – Z value to set.

Sets the values of this point.

Returns:This point object.
Return type:this

static squaredLength

Point3.squaredLength(p)
Arguments:

Returns the squared length of a vector.

Returns:Vector squared length.
Return type:number

static subtract

Point3.subtract(p1, p2)
Arguments:

Subtract two points.

Returns:Difference of p1 and p2.
Return type:Point3

toArray

Point3.toArray(arr)
Arguments:
  • arr ([number]()) – Array to assign.

Sets an array from this point.

Return type:[number]

toJson

Point3.toJson()

Creates an object ready for JSON serialization.

Returns:The prepared object.
Return type:IPoint3

static createFromArray

Point3.createFromArray(arr)
Arguments:
  • arr ([number]()) – None

Creates a point from an array of numbers

Returns:new point set from array elements
Return type:Point3

static cross

Point3.cross(p1, p2)
Arguments:

Calculate cross product.

Returns:Cross product of p1 and p2.
Return type:Point3

static distance

Point3.distance(p1, p2)
Arguments:

Calculate distance between two points

Returns:Distance between p1 and p2
Return type:number

static dot

Point3.dot(p1, p2)
Arguments:

Calculate dot product.

Returns:Dot product of p1 and p2.
Return type:number

static fromJson

Point3.fromJson(objData)
Arguments:
  • objData (unknown()) – An object given by [[toJson]].

Creates a new [[Point3]] from an object given by [[toJson]].

Returns:The prepared object.
Return type:Point3

static magnitude

Point3.magnitude(p)
Arguments:

Returns the length of a vector.

Returns:Vector length.
Return type:number

static zero

Point3.zero()

Creates a new Point initialized to (0,0,0).

Returns:New point with all elements set to 0.
Return type:Point3