@twinfinity/core
    Preparing search index...

    Class DynamicPolygon<Point>

    Represents a dynamic polygon. 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 area.

    Type Parameters

    Implements

    Index

    Constructors

    Properties

    BimCoreApi instance

    _onParentWorldMatrixUpdateObserver: Nullable<Observer<TransformNode>>
    dragPointPositioningFunction?: DragPointPositioningFunction

    Function to calculate the drag points position in the polygon.

    height: number = 0
    name: string

    Name of polyline

    onAreaLabelTrackableScreen: Observable<TrackCoordinate2D<Vector3>>

    Triggered when DynamicPolygon.apply is called or when camera moves around. By listening to this event it is possible to know when the area label X,Y position is updated (This always exists on a DynamicPolygon). 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.).

    onPointTrackableScreen: Observable<TrackCoordinate2D<Point>>

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

    Accessors

    • get bottomArea(): number

      Polygon bottom area. Only updated when DynamicPolygon.apply or DynamicPolygon.build is called. Calculated with polygonArea function with a height of zero.

      Returns number

      The polygon bottom area.

    • get isDisposed(): boolean

      Whether or not the mesh is disposed or not.

      Returns boolean

      boolean.

    • get isEmpty(): boolean

      Returns boolean

      true if polygon has no points. Otherwise false.

    • get isEnabled(): boolean

      Returns boolean

      true if the dynamic polygon is enabled otherwise false.

    • set isEnabled(b: boolean): void

      Sets isEnabled on the dynamicpolygon and sets isEnabled on the polygon mesh if it has any points.

      Parameters

      • b: boolean

        state to set

      Returns void

    • get mesh(): Mesh

      BabylonJS mesh.

      Returns Mesh

      mesh

    • get parent(): undefined | TransformNode

      Returns undefined | TransformNode

    • set parent(node: undefined | TransformNode): void

      Sets the parent of the DynamicPolygon without keeping the position in world space.

      Parameters

      • node: undefined | TransformNode

        new parent for the DynamicPolygon.

      Returns void

    Methods

    • Assigns points to define the polygon, this method can be used instead of build which adds virtual points

      Parameters

      • dynamicPolygonPoints: Point[]

      Returns void

    • Clears the polygon of all current points

      Returns void

    • Disposes the DynamicPolygon. It is no longer useable after this call.

      Returns void

    • Returns void

    • Internal

      If transformPointsToLocal is true, transforms all provided points according to this DynamicPolygon's parent. In either case, validate points and return the validation result

      Parameters

      • points: Vertex3[]

        The points to transform

      • transformPointsToLocal: boolean

        Whether to transform the points to the DynamicPolygon's parent local space before validating them

      Returns DynamicPolygonPointValidationResult

      The validation result NOTE: Internal API. Subject to change. Use of these APIs in production applications is not supported.

    • Get the world matrix of this DynamicPolygon

      Returns Matrix

      the world matrix for this DynamicPolygon.