# Class DynamicPolygonWithArbitraryPoints<Point>

Wrapper of DynamicPolygon to be able to create polygons that are any arbitrary shape such as circles, arrows etc.

#### Type Parameters

- Point extends ArbitraryShapePoint = ArbitraryShapePoint

#### Implements

- DynamicPolygonPointParent<ArbitraryShapePoint>

##### Index

### Constructors

constructor

### Properties

_api
dragPoint?
isEnabled
name
onPointTrackableScreen

### Accessors

mesh

### Methods

apply
build
clear
controlPoints
dispose
setMaterial

## Constructors

### constructor

- new DynamicPolygonWithArbitraryPoints<
  Point extends ArbitraryShapePoint = ArbitraryShapePoint,
  >(
  _polygonPointsFactory: (controlPoints: Vertex3[]) => Vertex3[],
  _polygonPointsValidator:
  | undefined
  | ((linePoints: Vertex3[]) => DynamicPolygonPointValidationResult),
  name: string,
  _api: BimCoreApi,
  pointFactory: DynamicPolygonPointFactoryHandler<DynamicPolygonPoint>,
  _controlPointFactory: ArbitraryShapePointFactoryHandler<Point>,
  recalculate2DEachFrame?: boolean,
  parent?: TransformNode,
  _dragPointPositioningFunctionOrIndex?: DragPointPositioningFunctionOrIndex,
  ): DynamicPolygonWithArbitraryPoints<Point>

  #### Type Parameters

  - Point extends ArbitraryShapePoint = ArbitraryShapePoint

  #### Parameters

  - _polygonPointsFactory: (controlPoints: Vertex3[]) => Vertex3[]
  - _polygonPointsValidator: undefined | ((linePoints: Vertex3[]) => DynamicPolygonPointValidationResult)
  - name: string
  - _api: BimCoreApi
  - pointFactory: DynamicPolygonPointFactoryHandler<DynamicPolygonPoint>
  - _controlPointFactory: ArbitraryShapePointFactoryHandler<Point>
  - recalculate2DEachFrame: boolean = false
  - `Optional` parent: TransformNode
  - `Optional`_dragPointPositioningFunctionOrIndex: DragPointPositioningFunctionOrIndex

  #### Returns DynamicPolygonWithArbitraryPoints<Point>

## Properties

### `Protected` `Readonly`_api

_api: BimCoreApi

### `Optional` dragPoint

dragPoint?: Point

### isEnabled

isEnabled: boolean

Implementation of DynamicPolygonPointParent.isEnabled

### `Readonly` name

name: string

### `Readonly` onPointTrackableScreen

onPointTrackableScreen: Observable<TrackCoordinate2D<Point>>

## Accessors

### mesh

- get mesh(): Mesh

  #### Returns Mesh

  the babylonjs mesh

## Methods

### apply

- apply(): void

  Applies changes which may have occured since the last time apply or build was called. When a control point is moved and then called, the shape of the polygon will be recalculated using the factory method provided in the constructor.

  #### Returns void

  Implementation of DynamicPolygonPointParent.apply

### build

- build(
  initialControlPoints: Vertex3[],
  transformPointsToLocal?: boolean,
  includeVirtualPoints?: boolean,
  ): DynamicPolygonPointValidationResult

  Similar to build in DynamicPolygon, but instead of providing the points that define every edge of the polygon, this method takes in control points which when used in together with the factory method can create arbitrary sets of points to define polygons

  #### Parameters

  - initialControlPoints: Vertex3[]

    The control points used by the factory method provided in the constructor, for example the centre and radius point of a circle

  - transformPointsToLocal: boolean = true

    Wheter to transform the points to the DynamicPolygon's parent local space before using them to build

  - includeVirtualPoints: boolean = true

    Wheter to create virtual points or not

  #### Returns DynamicPolygonPointValidationResult

  The DynamicPolygonPointValidationResult,

### clear

- clear(): void

  Clears the polygon of all current polygon points and control points.

  #### Returns void

### controlPoints

- controlPoints(
  predicate?: (p: DynamicPolygonPoint) => boolean,
  ): Generator<DynamicPolygonPoint, void, unknown>

  #### Parameters

  - `Optional` predicate: (p: DynamicPolygonPoint) => boolean

  #### Returns Generator<DynamicPolygonPoint, void, unknown>

### dispose

- dispose(): void

  Disposes the DynamicPolygonWithArbitraryPoints. It is no longer useable after this call.

  #### Returns void

### setMaterial

- setMaterial(material: Material): void

  Sets the material of the underlying DynamicPolygon

  #### Parameters

  - material: Material

  #### Returns void