editor › Globals › OFFBuilder
Class: OFFBuilder
Builds a KOFF (internal format)/OFF string from 2D or 3D polygons. NOTE: be aware that if useInternalFormat (so continued lines are holes) is set to true, we don't tessellate the mesh. Points of touching outlines are then deduplicated. When reconstructing the mesh, HalfEdgeMeshImplementation.fromPolygons handles this.
Hierarchy
- OFFBuilder
Index
Constructors
Properties
Methods
- _addFacet
- _addPolygon
- _addPolygon3D
- _addVertex
- _combineMappingMethods
- _convertArraysToThreePoints
- _ensureOutlineIs2D
- _getMapMethod
- _hasDuplicateVertices2D
- _hasDuplicateVertices3D
- _triangulate2D
- _triangulate3D
- addArrayPointPolygon3D
- addPolygon2D
- addVectorPolygon3D
- build
- setRoundPoints
- fromPlate
Constructors
constructor
+ new OFFBuilder(roundPoints: boolean, useInternalFormat: boolean): OFFBuilder
Defined in src/util/3DFormatConversion/OFFBuilder.ts:64
Parameters:
| Name | Type | Default |
|---|---|---|
roundPoints |
boolean | true |
useInternalFormat |
boolean | false |
Returns: OFFBuilder
Properties
Private facets
• facets: number[][][] = []
Defined in src/util/3DFormatConversion/OFFBuilder.ts:61
Private positionPrecision
• positionPrecision: any = Config.get("modelLimits.maximumPositionPrecision")
Defined in src/util/3DFormatConversion/OFFBuilder.ts:62
Private roundPoints
• roundPoints: any = null
Defined in src/util/3DFormatConversion/OFFBuilder.ts:63
Private Readonly useInternalFormat
• useInternalFormat: boolean
Defined in src/util/3DFormatConversion/OFFBuilder.ts:64
Private vertices
• vertices: Vector3[] = []
Defined in src/util/3DFormatConversion/OFFBuilder.ts:60
Methods
_addFacet
▸ _addFacet(facet: number[][]): void
Defined in src/util/3DFormatConversion/OFFBuilder.ts:262
Parameters:
| Name | Type |
|---|---|
facet |
number[][] |
Returns: void
_addPolygon
▸ _addPolygon(polygon: ReadonlyVectorPolygon3D): void
Defined in src/util/3DFormatConversion/OFFBuilder.ts:246
Parameters:
| Name | Type |
|---|---|
polygon |
ReadonlyVectorPolygon3D |
Returns: void
Private _addPolygon3D
▸ _addPolygon3D(vectorOutline: ReadonlyVectorCycle3D, vectorHoles: ReadonlyVectorCycle3D[], mapFromObject: any, mapToObject: any): void
Defined in src/util/3DFormatConversion/OFFBuilder.ts:336
Parameters:
| Name | Type |
|---|---|
vectorOutline |
ReadonlyVectorCycle3D |
vectorHoles |
ReadonlyVectorCycle3D[] |
mapFromObject |
any |
mapToObject |
any |
Returns: void
_addVertex
▸ _addVertex(newVertex: Vector3): number
Defined in src/util/3DFormatConversion/OFFBuilder.ts:251
Parameters:
| Name | Type |
|---|---|
newVertex |
Vector3 |
Returns: number
_combineMappingMethods
▸ _combineMappingMethods(firstMethod: any, secondMethod: any): any
Defined in src/util/3DFormatConversion/OFFBuilder.ts:234
Parameters:
| Name | Type |
|---|---|
firstMethod |
any |
secondMethod |
any |
Returns: any
_convertArraysToThreePoints
▸ _convertArraysToThreePoints(pointsAsArray: number[][]): Vector3[]
Defined in src/util/3DFormatConversion/OFFBuilder.ts:225
Parameters:
| Name | Type |
|---|---|
pointsAsArray |
number[][] |
Returns: Vector3[]
_ensureOutlineIs2D
▸ _ensureOutlineIs2D(outline: number[][]): void
Defined in src/util/3DFormatConversion/OFFBuilder.ts:124
Parameters:
| Name | Type |
|---|---|
outline |
number[][] |
Returns: void
_getMapMethod
▸ _getMapMethod(fromObject: any, toObject: any): any
Defined in src/util/3DFormatConversion/OFFBuilder.ts:194
Parameters:
| Name | Type |
|---|---|
fromObject |
any |
toObject |
any |
Returns: any
_hasDuplicateVertices2D
▸ _hasDuplicateVertices2D(outline: ArrayPoint2[]): boolean
Defined in src/util/3DFormatConversion/OFFBuilder.ts:266
Parameters:
| Name | Type |
|---|---|
outline |
ArrayPoint2[] |
Returns: boolean
_hasDuplicateVertices3D
▸ _hasDuplicateVertices3D(outline: ReadonlyVectorCycle3D): boolean
Defined in src/util/3DFormatConversion/OFFBuilder.ts:280
Parameters:
| Name | Type |
|---|---|
outline |
ReadonlyVectorCycle3D |
Returns: boolean
_triangulate2D
▸ _triangulate2D(polygon: Polygon): Vector3[][]
Defined in src/util/3DFormatConversion/OFFBuilder.ts:188
Parameters:
| Name | Type |
|---|---|
polygon |
Polygon |
Returns: Vector3[][]
_triangulate3D
▸ _triangulate3D(outline: ReadonlyVectorCycle3D, holes: ReadonlyVectorCycle3D[]): Vector3[][]
Defined in src/util/3DFormatConversion/OFFBuilder.ts:160
Parameters:
| Name | Type |
|---|---|
outline |
ReadonlyVectorCycle3D |
holes |
ReadonlyVectorCycle3D[] |
Returns: Vector3[][]
addArrayPointPolygon3D
▸ addArrayPointPolygon3D(outline: number[][], holes: number[][][], mapFromObject: any, mapToObject: any): void
Defined in src/util/3DFormatConversion/OFFBuilder.ts:144
Adds a 3D polygon to the OFF. If it needs to be triangulated, it is first mapped to 2D, triangulated and then mapped back again.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
outline |
number[][] | - | - |
holes |
number[][][] | [] | - |
mapFromObject |
any | null | [PhysicalObject |
mapToObject |
any | null | [PhysicalObject |
Returns: void
addPolygon2D
▸ addPolygon2D(outline: ArrayPoint2[], holes: ArrayPoint2[][], mapFromObject: any, mapToObject: any): void
Defined in src/util/3DFormatConversion/OFFBuilder.ts:86
Adds a 2D polygon to the OFF. 2D refers to the polygon being located at z=0. It gets triangulated if needed.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
outline |
ArrayPoint2[] | - | - |
holes |
ArrayPoint2[][] | [] | - |
mapFromObject |
any | null | [PhysicalObject |
mapToObject |
any | null | [PhysicalObject |
Returns: void
addVectorPolygon3D
▸ addVectorPolygon3D(polygon: ReadonlyVectorPolygon3D, mapFromObject: any, mapToObject: any): void
Defined in src/util/3DFormatConversion/OFFBuilder.ts:156
Parameters:
| Name | Type | Default |
|---|---|---|
polygon |
ReadonlyVectorPolygon3D | - |
mapFromObject |
any | null |
mapToObject |
any | null |
Returns: void
build
▸ build(): string
Defined in src/util/3DFormatConversion/OFFBuilder.ts:293
Returns: string
setRoundPoints
▸ setRoundPoints(roundPoints: boolean): void
Defined in src/util/3DFormatConversion/OFFBuilder.ts:71
Parameters:
| Name | Type | Default |
|---|---|---|
roundPoints |
boolean | true |
Returns: void
Static fromPlate
▸ fromPlate(plate: Plate): string
Defined in src/util/3DFormatConversion/OFFBuilder.ts:31
This function can be used to generate a .OFF-file of a single plate. It builds an OFF-string that contains the fully-extruded mesh of the plate including all it's surfaces.
Parameters:
| Name | Type | Description |
|---|---|---|
plate |
Plate | The plate to generate a .OFF-file of |
Returns: string