@twinfinity/core
    Preparing search index...

    Class PolyLine<Point>

    Represents a dynamic polyline. It is possible to add, insert and remove points to it and have those changes reflect its 3D visualization. Useful for tools that need to calculate distances between start and end points etc.

    Type Parameters

    Index

    Constructors

    Properties

    name: string

    Name of polyline

    onPointTrackableScreen: Observable<TrackCoordinate2D<Point>> = ...

    Triggered when apply is called or when camera moves around. By listening to this event it is possible to know when new points are added, updated and removed. It is also possible to see how far away the points are from the camera. What position they have in 2D space (perhaps one wants to add a HTML element to the DOM there.).

    points: Point[] = []

    Points that make up the polyline. Use usual array operations to add, remove insert points etc. When changes have been made call apply in order to visualize the changes as a LinesMesh.

    Accessors

    • get color(): Color3

      Color of the line.

      Returns Color3

      The color

    • set color(c: Color3): void

      Color of the line

      Parameters

      • c: Color3

        The color the line shall have.

      Returns void

    Methods

    • Apply changes made to the points array. This will mirror the changes in the visual representation of the polygon line. It will also trigger onPointTrackableScreen events.

      Returns void

    • Sets point array to zero and disables visibility for the lines mesh. Also removes coordinate trackers for labels if present.

      Returns void

    • Sets point array to zero and disables visibility for the lines mesh. Also removes coordinate trackers for labels if present. And disposes the linemesh.

      Returns void

    • Gets the distance of the polyline.

      Parameters

      • Optionalo: { end: Point }

        Optional. Specifies point where distance calculation should end. That is distance from first point up to this point.

      Returns number

      distance.

    • Makes it possible to iterate each line that points represents

      Parameters

      • predicate: (start: Point, end: Point) => boolean

        Called for each line with start and end vector. If predicate returns false then iteration is stopped.

      Returns void