Copyright © 2021 by K4.org
  (v.0.48.124)

Point is a pure geometry object. It is used for geometric computations within rules. It is based on the three.js Vector3 object.

Hierarchy

Implements

  • IKnown

Index

Constructors

constructor

  • new Point(_point: Vector3): Point
  • Parameters

    • _point: Vector3

    Returns Point

Properties

Static lengthEpsilon

lengthEpsilon: number = lengthEpsilon

This is the "point equivalence tolerance". Any points closer than this are considered the same.

Accessors

x

x:

Returns the x value of this point in world coordinates.

y

y:

Returns the y value of this point in world coordinates.

z

z:

Returns the z value of this point in world coordinates.

Methods

addv

  • Add vector to this, returning a new Point.

    Parameters

    Returns Point

between

  • Returns true if this Point is between (not inclusive) and on the line segment between pA and pB.

    Parameters

    Returns boolean

describe

  • describe(): string
  • Returns a string of the form 'p<x, y, z>' where x, y, and z are in world coordinates. Note that these values are for display only, and are not guaranteed to reproduce the point if read back in. Use xyz() for high resolution values.

    Returns string

dist

  • dist(point: Point): number
  • Returns the distance between this and the given point

    Parameters

    • point: Point

      Point to measure to

    Returns number

get3

  • get3(): Vector3
  • Returns the three.js implementation object

    Returns Vector3

interpolate

  • Interpolates along a line formed by this point and p1.

    Parameters

    • p1: Point

      The point to interpolate toward

    • u: number

      The interpolation amount, where 0.0 is this point, and 1.0 is p1. 0.5 will return the point midway between p0 and p1. Negative values and values greater than 1 are permitted.

    Returns Point

localX

  • localX(localFrame?: Frame): number
  • Returns the x-coordinate of this relative to localFrame. If localFrame is not supplied, then the inverse of the current context transform is used.

    example

    p(x,y,z).localX() => x

    Parameters

    • Optional localFrame: Frame

      The Frame in which we want the x-coordinate

    Returns number

localY

  • localY(localFrame?: Frame): number
  • Returns the y-coordinate of this relative to localFrame. If localFrame is not supplied, then the inverse of the current context transform is used.

    example

    p(x,y,z).localY() => y

    Parameters

    • Optional localFrame: Frame

      The Frame in which we want the y-coordinate

    Returns number

localZ

  • localZ(localFrame?: Frame): number
  • Returns the z-coordinate of this relative to localFrame. If localFrame is not supplied, then the inverse of the current context transform is used.

    example

    p(x,y,z).localZ() => z

    Parameters

    • Optional localFrame: Frame

      The Frame in which we want the z-coordinate

    Returns number

near

  • near(p: Point, tol: number): boolean
  • Returns true if p is within tol (3d distance) of this.

    Parameters

    • p: Point

      Point to be compared against

    • tol: number

      Tolerance

    Returns boolean

same

  • same(p: Point): boolean
  • Returns true if the two points are within lengthEpsilon of each other

    Parameters

    • p: Point

      Point to compare to

    Returns boolean

same3

  • same3(x: number, y: number, z: number): boolean
  • Returns true if the two points are within lengthEpsilon of each other

    Parameters

    • x: number

      Coordinate

    • y: number

      Coordinate

    • z: number

      Coordinate

    Returns boolean

sub

  • Returns the vector defined by subtracting the given point from this

    Parameters

    • point: Point

      Point to subtract

    Returns Vector

toVector

  • Converts this Point to a Vector from the world origin.

    Returns Vector

xform

  • Returns the point transformed by f

    Parameters

    • f: Frame

      Frame to transform by

    Returns Point

xyz

  • xyz(): string
  • Returns a string of comma-separated high-fidelity xyz values.

    Returns string

Static collinear

  • Returns true if the 3 points are collinear

    Parameters

    Returns boolean

Static cross3

  • Returns the cross product of (p1-p0)x(p2-p1). Returns undefined if points are collinear.

    Parameters

    • p0: Point

      First point

    • p1: Point

      Second point

    • p2: Point

      Third point

      This is used frequently in polygon work.

    Returns Vector

Static fromObject

  • fromObject(pojo: any): Point
  • Reconstitutes a Point from a POJO. The values are assumed to be in world coordinates.

    see

    parse

    example
    const pt = p(1,2,3); // create a point
    const str = JSON.stringify(pt); // Stringify it
    const obj = JSON.parse(str); // read the string into a POJO
    
    Point.fromObject(obj) => p<1,2,3>
    

    Parameters

    • pojo: any

      A plain old JS object with a _point property that has x, y, and z properies. This is commonly produced when Points are serialized to JSON.

    Returns Point

Static make

  • make(x: number, y: number, z: number): Point
  • Creates an absolute point with respect to world coordinates.

    example

    Point.make(1,2,3)

    Parameters

    • x: number

      Coordinate

    • y: number

      Coordinate

    • z: number

      Coordinate

    Returns Point

Static parse

  • parse(str: string): Point
  • Performs the "de-stringify operation"

    see

    fromObject

    example

    Point.parse(JSON.stringify(p)) => copy of p

    Parameters

    • str: string

      string to parse

    Returns Point