Communicator.Point3

 Point3

Constructors

constructor

  • new Point3(x: number, y: number, z: number): Point3
  • Creates a new point object.

    Parameters

    • x: number

      X value

    • y: number

      Y value

    • z: number

      Z value

    Returns Point3

Properties

x

x: number

y

y: number

z

z: number

Methods

add

  • Adds another point to this point.

    Parameters

    Returns Point3

    This point object.

assign

  • Sets this point equal to another point.

    Parameters

    • point: Point3

      The point to assign.

    Returns Point3

    This point object.

copy

  • Creates a copy of this point.

    Returns Point3

    Copy of this point object.

equals

  • equals(other: Point3): boolean
  • Strictly compares this point with another.

    Parameters

    • other: Point3

      Point to compare with.

    Returns boolean

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

equalsWithTolerance

  • equalsWithTolerance(other: Point3, tolerance: number): boolean
  • Compares this point with another using a tolerance.

    Parameters

    • other: Point3

      Point to compare with.

    • tolerance: number

      Tolerance to be used in the comparison.

    Returns boolean

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

forJson    [deprecated]

  • forJson(): Object
  • deprecated

    Use toJson instead.

    Returns Object

fromArray

  • fromArray(arr: number[]): Point3
  • Sets this point from an array.

    Parameters

    • arr: number[]

      Array to assign from.

    Returns Point3

    This point object.

isAxis

  • isAxis(): boolean
  • Returns a boolean value indicating if this vector lies on a major axis.

    Returns boolean

length

  • length(): number
  • Returns the length of this vector.

    Returns number

    Vector length.

negate

  • Negates the point.

    Returns Point3

    This object.

normalize

  • Normalizes the vector.

    Returns Point3

    This object.

scale

  • Scale the point by constant value.

    Parameters

    • k: number

      Constant value to scale by.

    Returns Point3

    Point object.

set

  • set(x: number, y: number, z: number): Point3
  • Sets the values of this point.

    Parameters

    • x: number

      X value to set.

    • y: number

      Y value to set.

    • z: number

      Z value to set.

    Returns Point3

    This point object.

squaredLength

  • squaredLength(): number
  • Returns the squared length of this vector.

    Returns number

    Vector squared length.

subtract

  • Subtracts another point from this point.

    Parameters

    Returns Point3

    This point object.

toArray

  • toArray(arr: number[]): void
  • Sets an array from this point.

    Parameters

    • arr: number[]

      Array to assign.

    Returns void

toJson

  • toJson(): Object
  • Creates an object ready for JSON serialization.

    Returns Object

    The prepared object.

Static add

  • Adds two points.

    Parameters

    Returns Point3

    Sum of p1 and p2.

Static construct    [deprecated]

Static createFromArray

  • createFromArray(arr: number[]): Point3
  • Creates a point from an array of numbers

    Parameters

    • arr: number[]

    Returns Point3

    new point set from array elements

Static cross

  • Calculate cross product.

    Parameters

    Returns Point3

    Cross product of p1 and p2.

Static distance

  • Calculate distance between two points

    Parameters

    Returns number

    Distance between p1 and p2

Static dot

  • Calculate dot product.

    Parameters

    Returns number

    Dot product of p1 and p2.

Static fromJson

  • fromJson(objData: any): Point3
  • Creates a new Point3 from an object given by toJson.

    Parameters

    • objData: any

      An object given by toJson.

    Returns Point3

    The prepared object.

Static scale

  • Scale a point by a constant factor

    Parameters

    • p: Point3
    • k: number

      Constant value to scale byS

    Returns Point3

    Copy of p scaled by a constant factor

Static subtract

  • Subtract two points.

    Parameters

    Returns Point3

    Difference of p1 and p2.

Static zero

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

    Returns Point3

    New point with all elements set to 0.