Skip to main content

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.

Index

Constructors

publicconstructor

  • new PolyLine<Point>(name: string, _api: BimCoreApi, options?: { maxPointCount?: number }): PolyLine<Point>

Properties

publicname

name: string

Name of polyline

publicreadonlyonPointTrackableScreen

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.).

publicpoints

points: Point[] = []

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

Accessors

publiccolor

  • get color(): Color3
  • set color(c: Color3): void
  • Color of the line.


    Returns Color3

    The color

  • Color of the line


    Parameters

    • c: Color3

      The color the line shall have.

    Returns void

Methods

publicapply

  • apply(): void
  • 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

publicclear

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


    Returns void

publicdispose

  • dispose(): 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

publicdistance

  • distance(o?: { end: Point }): number
  • Gets the distance of the polyline.


    Parameters

    • optionalo: { end: Point }

    Returns number

    distance.

publicforEachLine

  • forEachLine(predicate: (start: Point, end: Point) => boolean): void
  • 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