editor › Globals › ParametricHoleOrnament
Class: ParametricHoleOrnament
Creates a simple hole cutout on a Plate
Hierarchy
↳ Ornament
↳ ParametricHoleOrnament
Index
Constructors
Properties
Methods
- _applyPropertiesToClone
- _updateToPseudoPlateUv
- clone
- computeHole
- coversWholePlate
- distanceToPoint
- duplicateToPlate
- enableSafeMargin
- getAABB
- getChangeEventEmitter
- getCutout
- getCutoutPolygons
- getCutoutPolygonsOutlineLength
- getCutoutPromise
- getEngraving
- getInitializedPromise
- getIsFunctional
- getIsRepeating
- getIsXRepeating
- getIsYRepeating
- getMirroredToPseudoPlateUvTransformationMatrix
- getOBB
- getOffset
- getPlate
- getRealizer
- getRepeatedCutouts
- getRepeatedEngravings
- getRotation
- getSafeMargin
- getScale
- getScaledSize
- getSize
- getSizePromise
- getToPseudoPlateUvTransformationMatrix
- hasCutout
- hasEngraving
- isClickThrough
- isPointWithin
- mapGlobal
- mapLocal
- setIsFunctional
- setIsRepeating
- setIsXRepeating
- setIsYRepeating
- setOffset
- setPlate
- setRealizer
- setRotation
- setScale
- setSize
- setSizeFromCutoutOrEngraving
- transformCutoutPolygonsFromBackToFrontSide
Constructors
constructor
+ new ParametricHoleOrnament(cutoutOffset: number): ParametricHoleOrnament
Overrides Ornament.constructor
Defined in src/model/visualization/textures/ParametricHoleOrnament.ts:9
Parameters:
| Name | Type | Default |
|---|---|---|
cutoutOffset |
number | 1.2 |
Returns: ParametricHoleOrnament
Properties
Private cutoutOffset
• cutoutOffset: number
Defined in src/model/visualization/textures/ParametricHoleOrnament.ts:9
Margin width, not used right now
Protected plate
• plate: Plate | null = null
Inherited from ParametricHoleOrnament.plate
Defined in src/model/visualization/textures/Ornament.ts:55
Protected realizer
• realizer: IModelElementRealizer‹MakerAsset | TessellationDescriptor | OrnamentDescriptor› = null
Inherited from ParametricHoleOrnament.realizer
Defined in src/model/visualization/textures/Ornament.ts:56
Methods
Protected _applyPropertiesToClone
▸ _applyPropertiesToClone(clone: UvPositionable): void
Inherited from UvPositionable._applyPropertiesToClone
Defined in src/model/visualization/textures/UvPositionable.ts:240
Parameters:
| Name | Type |
|---|---|
clone |
UvPositionable |
Returns: void
Protected _updateToPseudoPlateUv
▸ _updateToPseudoPlateUv(): void
Inherited from UvPositionable._updateToPseudoPlateUv
Defined in src/model/visualization/textures/UvPositionable.ts:251
Calculate a Matrix3 that transforms scaled texture uv coordinate (0,0 to 1,1) to pseudo plate uv coordinates (mm from plate origin)
Returns: void
clone
▸ clone(): UvPositionable
Inherited from UvPositionable.clone
Defined in src/model/visualization/textures/UvPositionable.ts:217
Generates a clone with identical values
Returns: UvPositionable
computeHole
▸ computeHole(): Polygon‹›[]
Defined in src/model/visualization/textures/ParametricHoleOrnament.ts:19
This will create a single cutout that stretches across the entire plate.
Returns: Polygon‹›[]
coversWholePlate
▸ coversWholePlate(): boolean
Inherited from ParametricHoleOrnament.coversWholePlate
Defined in src/model/visualization/textures/Ornament.ts:136
Returns: boolean
distanceToPoint
▸ distanceToPoint(point: ReadonlyVector3): number
Inherited from UvPositionable.distanceToPoint
Defined in src/model/visualization/textures/UvPositionable.ts:112
Uses the AABB to determine the distance to a point
Parameters:
| Name | Type | Description |
|---|---|---|
point |
ReadonlyVector3 | test point in texture coordinates |
Returns: number
the distance from the point to the aabb)
duplicateToPlate
▸ duplicateToPlate(newPlate: any, plateSide: PlateSides): Promise‹Ornament›
Inherited from ParametricHoleOrnament.duplicateToPlate
Defined in src/model/visualization/textures/Ornament.ts:91
Clones this ornament and adds it to another plate instance, but at the same assembly position.
Parameters:
| Name | Type |
|---|---|
newPlate |
any |
plateSide |
PlateSides |
enableSafeMargin
▸ enableSafeMargin(plate: any): void
Inherited from ParametricHoleOrnament.enableSafeMargin
Defined in src/model/visualization/textures/Ornament.ts:280
Parameters:
| Name | Type |
|---|---|
plate |
any |
Returns: void
getAABB
▸ getAABB(): AABB
Inherited from UvPositionable.getAABB
Defined in src/model/visualization/textures/UvPositionable.ts:66
Calculates the AABB for this UVPositionable in texture coordinates (rotation, offset and scaling are already applied, for more detailed results use getOBB)
If properties have not change from the last call, the cached aabb will be returned
Returns: AABB
getChangeEventEmitter
▸ getChangeEventEmitter(): IPublicEventEmitterInterface‹UvPositionable›
Inherited from UvPositionable.getChangeEventEmitter
Defined in src/model/visualization/textures/UvPositionable.ts:56
Returns: IPublicEventEmitterInterface‹UvPositionable›
getCutout
▸ getCutout(): SvgDrawable | null
Inherited from ParametricHoleOrnament.getCutout
Defined in src/model/visualization/textures/Ornament.ts:155
Return the cutout of this Ornament
Returns: SvgDrawable | null
getCutoutPolygons
▸ getCutoutPolygons(): Polygon‹›[]
Overrides Ornament.getCutoutPolygons
Defined in src/model/visualization/textures/ParametricHoleOrnament.ts:44
Returns: Polygon‹›[]
getCutoutPolygonsOutlineLength
▸ getCutoutPolygonsOutlineLength(): number
Inherited from ParametricHoleOrnament.getCutoutPolygonsOutlineLength
Defined in src/model/visualization/textures/Ornament.ts:274
Returns: number
getCutoutPromise
▸ getCutoutPromise(): Promise‹Polygon[]›
Inherited from ParametricHoleOrnament.getCutoutPromise
Defined in src/model/visualization/textures/Ornament.ts:303
Returns: Promise‹Polygon[]›
getEngraving
▸ getEngraving(): Drawable | null
Inherited from ParametricHoleOrnament.getEngraving
Defined in src/model/visualization/textures/Ornament.ts:140
Returns: Drawable | null
getInitializedPromise
▸ getInitializedPromise(): Promise‹any[]›
Inherited from ParametricHoleOrnament.getInitializedPromise
Defined in src/model/visualization/textures/Ornament.ts:295
Returns: Promise‹any[]›
getIsFunctional
▸ getIsFunctional(): boolean
Inherited from ParametricHoleOrnament.getIsFunctional
Defined in src/model/visualization/textures/Ornament.ts:187
Returns: boolean
getIsRepeating
▸ getIsRepeating(): boolean
Inherited from ParametricHoleOrnament.getIsRepeating
Defined in src/model/visualization/textures/Ornament.ts:212
Returns: boolean
getIsXRepeating
▸ getIsXRepeating(): boolean
Inherited from ParametricHoleOrnament.getIsXRepeating
Defined in src/model/visualization/textures/Ornament.ts:204
Returns: boolean
getIsYRepeating
▸ getIsYRepeating(): boolean
Inherited from ParametricHoleOrnament.getIsYRepeating
Defined in src/model/visualization/textures/Ornament.ts:208
Returns: boolean
getMirroredToPseudoPlateUvTransformationMatrix
▸ getMirroredToPseudoPlateUvTransformationMatrix(): Matrix3
Inherited from UvPositionable.getMirroredToPseudoPlateUvTransformationMatrix
Defined in src/model/visualization/textures/UvPositionable.ts:210
Same as getToPseudoPlateUvTransformationMatrix, but mirror the positionable around the x axis at the beginning. Required for rendering cutouts in the shader that need to be mirrored because they are placed on the back of a plate
Returns: Matrix3
getOBB
▸ getOBB(): OBB
Inherited from UvPositionable.getOBB
Defined in src/model/visualization/textures/UvPositionable.ts:51
Calculates the OBB for this UvPositionable in texture coordinates (rotation, offset and scaling already applied)
Returns: OBB
getOffset
▸ getOffset(): Vector3
Inherited from UvPositionable.getOffset
Defined in src/model/visualization/textures/UvPositionable.ts:119
Returns the UvPositionable offset (= center position of the UvPositionable) in texture coordinates
Returns: Vector3
getPlate
▸ getPlate(): Plate | null
Inherited from ParametricHoleOrnament.getPlate
Defined in src/model/visualization/textures/Ornament.ts:121
Get the plate the ornament currently is on, or null, if the ornament is not on any plate
Returns: Plate | null
getRealizer
▸ getRealizer(): IModelElementRealizer‹MakerAsset‹› | TessellationDescriptor‹› | OrnamentDescriptor‹››
Inherited from ParametricHoleOrnament.getRealizer
Defined in src/model/visualization/textures/Ornament.ts:148
Returns: IModelElementRealizer‹MakerAsset‹› | TessellationDescriptor‹› | OrnamentDescriptor‹››
getRepeatedCutouts
▸ getRepeatedCutouts(area: AABB): IOffsetDrawable[]
Inherited from ParametricHoleOrnament.getRepeatedCutouts
Defined in src/model/visualization/textures/Ornament.ts:179
Get repeated drawables of the cutouts of this ornament. Will contain only one element if no repetition is set
Parameters:
| Name | Type | Description |
|---|---|---|
area |
AABB | plate coordinates that needs to be covered |
Returns: IOffsetDrawable[]
getRepeatedEngravings
▸ getRepeatedEngravings(area: AABB): IOffsetDrawable[]
Inherited from ParametricHoleOrnament.getRepeatedEngravings
Defined in src/model/visualization/textures/Ornament.ts:171
Get repeated drawables of the engraving of this ornament. Will contain only one element if no repetition is set
Parameters:
| Name | Type | Description |
|---|---|---|
area |
AABB | plate coordinates that needs to be covered |
Returns: IOffsetDrawable[]
getRotation
▸ getRotation(): number
Inherited from UvPositionable.getRotation
Defined in src/model/visualization/textures/UvPositionable.ts:155
Get the rotation
Returns: number
CW rotation in degrees around the center of the UvPositionable
getSafeMargin
▸ getSafeMargin(): SafeMargin | null
Inherited from ParametricHoleOrnament.getSafeMargin
Defined in src/model/visualization/textures/Ornament.ts:307
Returns: SafeMargin | null
getScale
▸ getScale(): Vector3
Inherited from UvPositionable.getScale
Defined in src/model/visualization/textures/UvPositionable.ts:137
Get the scale
Returns: Vector3
the scale of the UvPositionable that is applied to its size
getScaledSize
▸ getScaledSize(target?: Vector3): Vector3
Inherited from UvPositionable.getScaledSize
Defined in src/model/visualization/textures/UvPositionable.ts:187
Get the actual size, which is the native size with the scale vector applied
Parameters:
| Name | Type |
|---|---|
target? |
Vector3 |
Returns: Vector3
getSize
▸ getSize(): Vector3
Inherited from UvPositionable.getSize
Defined in src/model/visualization/textures/UvPositionable.ts:172
Get the native size of the UvPositionable, without scale being applied, in mm. Null-vector by default, as there usually needs to be some external knowledge to determine the native size.
Returns: Vector3
getSizePromise
▸ getSizePromise(): Promise‹void›
Inherited from ParametricHoleOrnament.getSizePromise
Defined in src/model/visualization/textures/Ornament.ts:299
Returns: Promise‹void›
getToPseudoPlateUvTransformationMatrix
▸ getToPseudoPlateUvTransformationMatrix(): Matrix3
Inherited from UvPositionable.getToPseudoPlateUvTransformationMatrix
Defined in src/model/visualization/textures/UvPositionable.ts:201
Return a matrix that transforms scaled texture coordinates to pseudo plate uv coordinates (the ones described by position, scale and rotation)
Returns: Matrix3
hasCutout
▸ hasCutout(): boolean
Defined in src/model/visualization/textures/ParametricHoleOrnament.ts:48
Returns: boolean
hasEngraving
▸ hasEngraving(): boolean
Inherited from ParametricHoleOrnament.hasEngraving
Defined in src/model/visualization/textures/Ornament.ts:163
Returns: boolean
isClickThrough
▸ isClickThrough(): boolean
Overrides Ornament.isClickThrough
Defined in src/model/visualization/textures/ParametricHoleOrnament.ts:40
Returns: boolean
isPointWithin
▸ isPointWithin(): boolean
Overrides UvPositionable.isPointWithin
Defined in src/model/visualization/textures/ParametricHoleOrnament.ts:36
Returns: boolean
mapGlobal
▸ mapGlobal(uvCoord: ReadonlyVector3, target: Vector3): Vector3
Inherited from UvPositionable.mapGlobal
Defined in src/model/visualization/textures/UvPositionable.ts:231
Parameters:
| Name | Type | Default |
|---|---|---|
uvCoord |
ReadonlyVector3 | - |
target |
Vector3 | new Vector3() |
Returns: Vector3
mapLocal
▸ mapLocal(uvCoord: ReadonlyVector3, target: Vector3): Vector3
Inherited from UvPositionable.mapLocal
Defined in src/model/visualization/textures/UvPositionable.ts:223
Parameters:
| Name | Type | Default |
|---|---|---|
uvCoord |
ReadonlyVector3 | - |
target |
Vector3 | new Vector3() |
Returns: Vector3
setIsFunctional
▸ setIsFunctional(): void
Inherited from ParametricHoleOrnament.setIsFunctional
Defined in src/model/visualization/textures/Ornament.ts:183
Returns: void
setIsRepeating
▸ setIsRepeating(isRepeating: boolean): void
Inherited from ParametricHoleOrnament.setIsRepeating
Defined in src/model/visualization/textures/Ornament.ts:191
Parameters:
| Name | Type | Default |
|---|---|---|
isRepeating |
boolean | true |
Returns: void
setIsXRepeating
▸ setIsXRepeating(isXRepeating: boolean): void
Inherited from ParametricHoleOrnament.setIsXRepeating
Defined in src/model/visualization/textures/Ornament.ts:196
Parameters:
| Name | Type | Default |
|---|---|---|
isXRepeating |
boolean | true |
Returns: void
setIsYRepeating
▸ setIsYRepeating(isYRepeating: boolean): void
Inherited from ParametricHoleOrnament.setIsYRepeating
Defined in src/model/visualization/textures/Ornament.ts:200
Parameters:
| Name | Type | Default |
|---|---|---|
isYRepeating |
boolean | true |
Returns: void
setOffset
▸ setOffset(newOffset: Vector3, applySafeMargin: boolean): void
Inherited from ParametricHoleOrnament.setOffset
Overrides UvPositionable.setOffset
Defined in src/model/visualization/textures/Ornament.ts:284
Parameters:
| Name | Type | Default |
|---|---|---|
newOffset |
Vector3 | - |
applySafeMargin |
boolean | true |
Returns: void
setPlate
▸ setPlate(newPlate: Plate): void
Inherited from ParametricHoleOrnament.setPlate
Defined in src/model/visualization/textures/Ornament.ts:129
Only to be called by the plate when adding the ornament
Parameters:
| Name | Type | Description |
|---|---|---|
newPlate |
Plate | The new plate or null. |
Returns: void
setRealizer
▸ setRealizer(realizer: IModelElementRealizer‹any›): void
Inherited from ParametricHoleOrnament.setRealizer
Defined in src/model/visualization/textures/Ornament.ts:144
Parameters:
| Name | Type |
|---|---|
realizer |
IModelElementRealizer‹any› |
Returns: void
setRotation
▸ setRotation(newRotation: number): void
Inherited from UvPositionable.setRotation
Defined in src/model/visualization/textures/UvPositionable.ts:163
Set the rotation
Parameters:
| Name | Type | Description |
|---|---|---|
newRotation |
number | new rotation in radians |
Returns: void
setScale
▸ setScale(newScale: ReadonlyVector3, offset: Vector3, applySafeMargin: boolean): void
Inherited from ParametricHoleOrnament.setScale
Overrides UvPositionable.setScale
Defined in src/model/visualization/textures/Ornament.ts:340
Parameters:
| Name | Type | Default |
|---|---|---|
newScale |
ReadonlyVector3 | - |
offset |
Vector3 | nullVector |
applySafeMargin |
boolean | true |
Returns: void
setSize
▸ setSize(size: Vector3): void
Inherited from UvPositionable.setSize
Defined in src/model/visualization/textures/UvPositionable.ts:179
Set the size
Parameters:
| Name | Type |
|---|---|
size |
Vector3 |
Returns: void
setSizeFromCutoutOrEngraving
▸ setSizeFromCutoutOrEngraving(maxSize?: number): void
Inherited from ParametricHoleOrnament.setSizeFromCutoutOrEngraving
Defined in src/model/visualization/textures/Ornament.ts:311
Parameters:
| Name | Type |
|---|---|
maxSize? |
number |
Returns: void
Static transformCutoutPolygonsFromBackToFrontSide
▸ transformCutoutPolygonsFromBackToFrontSide(cutoutPolygons: Polygon[], ornamentOffset: Vector3): void
Inherited from ParametricHoleOrnament.transformCutoutPolygonsFromBackToFrontSide
Defined in src/model/visualization/textures/Ornament.ts:46
Transforms cutouts from an ornament placed on the back side so that they can be applied onto the front side.
In order to correctly transform cutouts on the back side to the front side, they have to be flipped around the plate's y-axis (= mirror x in plate-local coordinates), around the ornament's center (as all ornaments positions are their center). See also Drawable.drawSync mirrorX.
Parameters:
| Name | Type | Description |
|---|---|---|
cutoutPolygons |
Polygon[] | the polygons to transform, array will be modified |
ornamentOffset |
Vector3 | the ornament's offset, i.e. position |
Returns: void