Skip to main content

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.

Implements

Index

Constructors

publicconstructor

  • Polygon constructor, counter-clockwise polygon winding order.


    Type parameters

    Parameters

    • name: string

      Name of polyline

    • _api: BimCoreApi

      BimCoreApi instance

    • pointFactory: DynamicPolygonPointFactoryHandler<Point>

      Factory method which is used to create the instances of generic class type Point.

    • recalculate2DEachFrame: boolean = false

      If true then it updates the 2D positions for each tracked 3D coordinate at the end of each frame.

    • optionalparent: TransformNode

      If Babylon TransformNode is provided the dynamic polygon will attach as a child and follow its parent.

    • optionaldragPointPositioningFunction: DragPointPositioningFunction

      Function to calculate the drag points position in the polygon.

    Returns DynamicPolygon<Point>

Properties

publicoptionaldragPointPositioningFunction

dragPointPositioningFunction?: DragPointPositioningFunction

Function to calculate the drag points position in the polygon.

publicheight

height: number = 0

publicreadonlyname

name: string

Name of polyline

publicreadonlyonAreaLabelTrackableScreen

onAreaLabelTrackableScreen: Observable<TrackCoordinate2D<Vector3>>

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

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

publicbottomArea

  • get bottomArea(): number
  • Polygon bottom area. Only updated when apply or build is called. Calculated with polygonArea function with a height of zero.


    Returns number

    The polygon bottom area.

publicinteriorPoint

  • Interior point. Only updated when apply or build is called.


    Returns Vertex3

    The interior point.

publicisDisposed

  • get isDisposed(): boolean
  • Whether or not the mesh is disposed or not.


    Returns boolean

    boolean.

publicisEmpty

  • get isEmpty(): boolean

  • Returns boolean

    true if polygon has no points. Otherwise false.

publicisEnabled

  • get isEnabled(): boolean
  • set isEnabled(b: boolean): void

  • Returns boolean

    true if the dynamic polygon is enabled otherwise false.

  • 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

publicmesh

  • get mesh(): Mesh
  • BabylonJS mesh.


    Returns Mesh

    mesh

publicparent

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

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


    Parameters

    • node: undefined | TransformNode

      new parent for the DynamicPolygon.

    Returns void

publicplane

  • get plane(): Plane
  • Plane spanned by points. Only updated when build or assignNewPolygonPoints is called.


    Returns Plane

    The Plane.

publicsurfaceArea

  • get surfaceArea(): number
  • Polygon surface area. Only updated when apply or build is called.


    Returns number

    The polygon surface area.

publicvolume

  • get volume(): number
  • Polygon volume. Only updated when there exists a height and apply or build is called.


    Returns number

    The polygon volume.

Methods

publicapply

  • apply(): void
  • Applies changes to polygon which occurred when calling methods on move, virtual and delete. It will also trigger onPointTrackableScreen events.


    Returns void

publicassignNewPolygonPoints

  • assignNewPolygonPoints(dynamicPolygonPoints: Point[]): void
  • Assigns points to define the polygon, this method can be used instead of build which adds virtual points


    Parameters

    • dynamicPolygonPoints: Point[]

    Returns void

publicbuild

publicclear

  • clear(): void
  • Clears the polygon of all current points


    Returns void

publicdispose

  • dispose(): void
  • Disposes the DynamicPolygon. It is no longer useable after this call.


    Returns void

publicpoints

registerParentWorldMatrixCallback

  • registerParentWorldMatrixCallback(): void
  • Returns void

worldMatrix

  • worldMatrix(): Matrix
  • Get the world matrix of this DynamicPolygon


    Returns Matrix

    the world matrix for this DynamicPolygon.

publicstaticvalidatePoints