Skip to content

editorGlobalsUvPositionable

Class: UvPositionable

A UvPositionable is a two dimensional something that has a certain size and can be positioned in a UV coordinate system by specifying an offset, a scale and a rotation

Hierarchy

  • UvPositionable

KyubTexture

Ornament

Index

Properties

Methods

Properties

Private aabbDirty

aabbDirty: boolean = true

Defined in src/model/visualization/textures/UvPositionable.ts:27

Will be set if any changes happen to properties needed to calculate the aabb. If not dirty, the next call to getAABB will return cachedAABB


Private cachedAABB

cachedAABB: AABB

Defined in src/model/visualization/textures/UvPositionable.ts:30

The last calculated aabb or undefined if never calculated before. Always use getAABB to get the aabb!


Private Readonly changeEventEmitter

changeEventEmitter: EventEmitterUvPositionable = new EventEmitter()

Defined in src/model/visualization/textures/UvPositionable.ts:46


Private mirroredToPseudoPlateUv

mirroredToPseudoPlateUv: Matrix3 = new Matrix3()

Defined in src/model/visualization/textures/UvPositionable.ts:44

Same as toPseudoPlateUv, but gives a mapping that mirrors the element on the x axis first.


Private offset

offset: Vector3 = new Vector3(0, 0, 0)

Defined in src/model/visualization/textures/UvPositionable.ts:15

Offset of the UvPositionable in plate-local uv coordinates (equals millimeters


Private rotation

rotation: number = 0

Defined in src/model/visualization/textures/UvPositionable.ts:33

Rotation of the UvPositionable in radians CW around the center of the object


Private scale

scale: Vector3 = new Vector3(1, 1, 0)

Defined in src/model/visualization/textures/UvPositionable.ts:18

Scale of the UvPositionable


Private size

size: Vector3 = new Vector3(1, 1, 0)

Defined in src/model/visualization/textures/UvPositionable.ts:21

Native size of the UvPositionable in mm getSize


Private toPseudoPlateUv

toPseudoPlateUv: Matrix3 = new Matrix3()

Defined in src/model/visualization/textures/UvPositionable.ts:39

Transformation matrix from scaled texture coordinates ((0,0) bottom left, (1,1) top right) to pseudo plate uv coordinates (origin in plate origin, axes based on millimeters)

Methods

Protected _applyPropertiesToClone

_applyPropertiesToClone(clone: UvPositionable): void

Defined in src/model/visualization/textures/UvPositionable.ts:240

Parameters:

Name Type
clone UvPositionable

Returns: void


Protected _updateToPseudoPlateUv

_updateToPseudoPlateUv(): void

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

Defined in src/model/visualization/textures/UvPositionable.ts:217

Generates a clone with identical values

Returns: UvPositionable


distanceToPoint

distanceToPoint(point: ReadonlyVector3): number

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)


getAABB

getAABB(): AABB

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(): IPublicEventEmitterInterfaceUvPositionable

Defined in src/model/visualization/textures/UvPositionable.ts:56

Returns: IPublicEventEmitterInterfaceUvPositionable


getMirroredToPseudoPlateUvTransformationMatrix

getMirroredToPseudoPlateUvTransformationMatrix(): Matrix3

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

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

Defined in src/model/visualization/textures/UvPositionable.ts:119

Returns the UvPositionable offset (= center position of the UvPositionable) in texture coordinates

Returns: Vector3


getRotation

getRotation(): number

Defined in src/model/visualization/textures/UvPositionable.ts:155

Get the rotation

Returns: number

CW rotation in degrees around the center of the UvPositionable


getScale

getScale(): Vector3

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

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

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


getToPseudoPlateUvTransformationMatrix

getToPseudoPlateUvTransformationMatrix(): Matrix3

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


isPointWithin

isPointWithin(point: Vector3): boolean

Defined in src/model/visualization/textures/UvPositionable.ts:102

Uses the AABB to determine whether a point is within the UvPositionable

Parameters:

Name Type Description
point Vector3 test point in texture coordinates

Returns: boolean

Whether the point is within the ornament's AABB


mapGlobal

mapGlobal(uvCoord: ReadonlyVector3, target: Vector3): Vector3

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

Defined in src/model/visualization/textures/UvPositionable.ts:223

Parameters:

Name Type Default
uvCoord ReadonlyVector3 -
target Vector3 new Vector3()

Returns: Vector3


setOffset

setOffset(newOffset: Vector3): void

Defined in src/model/visualization/textures/UvPositionable.ts:127

Set the offset

Parameters:

Name Type Description
newOffset Vector3 new offset (= center position of the UvPositionable) in texture coordinates

Returns: void


setRotation

setRotation(newRotation: number): void

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): void

Defined in src/model/visualization/textures/UvPositionable.ts:145

Set the scale

Parameters:

Name Type Description
newScale ReadonlyVector3 the new scale of the UvPositionable

Returns: void


setSize

setSize(size: Vector3): void

Defined in src/model/visualization/textures/UvPositionable.ts:179

Set the size

Parameters:

Name Type
size Vector3

Returns: void