Point3

class Communicator.Point3()

Constructors

Properties


Constructors

Point3.constructor(x, y, z)

Creates a new point object.

Arguments
  • x (number()) –

  • y (number()) –

  • z (number()) –

Return type

Point3()

Properties

Point3.x
Type

number

Point3.y
Type

number

Point3.z
Type

number

Methods

static add

Point3.add(p1, p2)

Adds two points.

Arguments
Return type

Point3()

Returns

Sum of p1 and p2.

assign

Point3.assign(point)

Sets this point equal to another point.

Arguments
  • point (Point3()) – The point to assign.

Return type

Point3()

Returns

This point object.

copy

Point3.copy()

Creates a copy of this point.

Return type

Point3()

Returns

Copy of this point object.

equals

Point3.equals(other)

Strictly compares this point with another.

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

Return type

boolean

Returns

True if the values of this point equal those of the other.

equalsWithTolerance

Point3.equalsWithTolerance(other, tolerance)

Compares this point with another using a tolerance.

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

  • tolerance (number()) – Tolerance to be used in the comparison.

Return type

boolean

Returns

True if the values of this point equal those of the other.

forJson

Point3.forJson()
Deprecated

Use toJson instead.

Return type

Object

fromArray

Point3.fromArray(arr)

Sets this point from an array.

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

Return type

Point3()

Returns

This point object.

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.

Return type

number

Returns

Vector length.

negate

Point3.negate()

Negates the point.

Return type

Point3()

Returns

This object.

normalize

Point3.normalize()

Normalizes the vector.

Return type

Point3()

Returns

This object.

static scale

Point3.scale(p, k)

Scale a point by a constant factor

Arguments
  • p (Point3()) –

  • k (number()) – Constant value to scale byS

Return type

Point3()

Returns

Copy of p scaled by a constant factor

set

Point3.set(x, y, z)

Sets the values of this point.

Arguments
  • x (number()) – X value to set.

  • y (number()) – Y value to set.

  • z (number()) – Z value to set.

Return type

Point3()

Returns

This point object.

squaredLength

Point3.squaredLength()

Returns the squared length of this vector.

Return type

number

Returns

Vector squared length.

static subtract

Point3.subtract(p1, p2)

Subtract two points.

Arguments
Return type

Point3()

Returns

Difference of p1 and p2.

toArray

Point3.toArray(arr)

Sets an array from this point.

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

Return type

void

toJson

Point3.toJson()

Creates an object ready for JSON serialization.

Return type

Object

Returns

The prepared object.

static construct

Point3.construct(obj)
Deprecated

Use fromJson instead.

Arguments
  • obj (any()) –

Return type

Point3()

static createFromArray

Point3.createFromArray(arr)

Creates a point from an array of numbers

Arguments
  • arr ([number]()) –

Return type

Point3()

Returns

new point set from array elements

static cross

Point3.cross(p1, p2)

Calculate cross product.

Arguments
Return type

Point3()

Returns

Cross product of p1 and p2.

static distance

Point3.distance(p1, p2)

Calculate distance between two points

Arguments
Return type

number

Returns

Distance between p1 and p2

static dot

Point3.dot(p1, p2)

Calculate dot product.

Arguments
Return type

number

Returns

Dot product of p1 and p2.

static fromJson

Point3.fromJson(objData)

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

Arguments
  • objData (any()) – An object given by toJson

Return type

Point3()

Returns

The prepared object.

static zero

Point3.zero()

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

Return type

Point3()

Returns

New point with all elements set to 0.