Class PointTracker

Point tracker. Create via Trackers.point().

Hierarchy (view full)

Constructors

Properties

debug: boolean
id: string
initialRelation: undefined | PointRelation
lastResult: undefined | Readonly<{
    fromInitial: PointRelationResult;
    fromLast: PointRelationResult;
    fromMark: undefined | PointRelationResult;
    values: readonly Point[];
}>
markRelation: undefined | PointRelation

Accessors

  • get elapsed(): number
  • Returns the elapsed time, in milliseconds since the initial value

    Returns number

  • get length(): number
  • Returns the total length of accumulated points. Returns 0 if points were not saved, or there's only one

    Returns number

  • get line(): PolyLine
  • Returns a polyline representation of stored points. Returns an empty array if points were not saved, or there's only one.

    Returns PolyLine

  • get lineStartEnd(): Line
  • Returns a line from initial point to last point.

    If there are less than two points, Lines.Empty is returned

    Returns Line

  • get size(): number
  • Returns number of recorded values (includes the initial value in the count)

    Returns number

  • get vectorCartesian(): Point
  • Returns a vector of the initial/last points of the tracker. Returns as a Cartesian coordinate

    Returns Point

  • get vectorPolar(): Coord
  • Returns a vector of the initial/last points of the tracker. Returns as a polar coordinate

    Returns Coord

  • get x(): number
  • Returns the last x coord

    Returns number

  • get y(): number
  • Returns the last y coord

    Returns number

  • get z(): undefined | number
  • Returns the last z coord (or undefined if not available)

    Returns undefined | number

Methods

  • Returns angle (in radians) from latest point to the initial point If there are less than two points, undefined is return.

    Returns undefined | number

    Angle in radians

  • Difference between last point and the initial point, calculated as a simple subtraction of x,y & z.

    Points.Placeholder is returned if there's only one point so far.

    Returns Point | Point3d

  • Returns distance from latest point to initial point. If there are less than two points, zero is returned.

    This is the direct distance from initial to last, not the accumulated length.

    Returns number

    Distance

  • Makes a 'mark' in the tracker, allowing you to compare values to this point.

    Returns void

  • Notification that buffer has been knocked down to sampleLimit.

    This will reset the initialRelation, which will use the new oldest value.

    Parameters

    Returns void

  • Adds a value, returning computed result.

    At this point, we check if the buffer is larger than resetAfterSamples. If so, reset() is called. If not, we check sampleLimit. If the buffer is twice as large as sample limit, trimStore() is called to take it down to sample limit, and onTrimmed() is called.

    Parameters

    Returns Readonly<{
        fromInitial: PointRelationResult;
        fromLast: PointRelationResult;
        fromMark: undefined | PointRelationResult;
        values: readonly Point[];
    }>

  • Reduces size of value store to limit. Returns number of remaining items

    Parameters

    • limit: number

    Returns number