# Transform

Class

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/math.ts#L23

A source-to-engine coordinate transform comprising translation, rotation
and uniform scale. Lives alongside a DataTable to describe how raw
column data maps to PlayCanvas engine coordinates.

**Example**

```ts
const t = new Transform().fromEulers(0, 0, 180);
console.log(t.isIdentity()); // false

const inv = t.clone().invert();
console.log(t.mul(inv).isIdentity()); // true
```

## Properties

### PLY

```ts
static PLY: Readonly<Transform>
```

PLY coordinate convention: 180-degree rotation around Z.
Used by formats that store Gaussian data in PLY-style coordinates:
PLY, splat, KSplat, SPZ, and SOG.

## Methods

### clone

```ts
clone(): Transform
```

Creates a deep copy of this transform.

**Returns** [`Transform`](https://api.playcanvas.com/splat-transform/classes/Transform.md): A new Transform with the same values.

### equals

```ts
equals(other: Transform, epsilon?: number): boolean
```

Tests whether this transform equals another within the given tolerance.
Quaternion comparison accounts for double-cover (q and -q represent
the same rotation).

**Parameters**

- `other` ([`Transform`](https://api.playcanvas.com/splat-transform/classes/Transform.md)): The transform to compare against.
- `epsilon` (`number`, optional, default `1e-6`): Floating-point tolerance. Defaults to 1e-6.

**Returns** `boolean`: True if the transforms are equal within the tolerance.

### fromEulers

```ts
fromEulers(x: number, y: number, z: number): Transform
```

Sets this transform to a rotation-only transform from Euler angles in degrees.

**Parameters**

- `x` (`number`): Rotation around X axis in degrees.
- `y` (`number`): Rotation around Y axis in degrees.
- `z` (`number`): Rotation around Z axis in degrees.

**Returns** [`Transform`](https://api.playcanvas.com/splat-transform/classes/Transform.md): This transform (for chaining).

### getMatrix

```ts
getMatrix(result: Mat4): Mat4
```

Fills the provided Mat4 with the TRS matrix for this transform.

**Parameters**

- `result` (`Mat4`): The Mat4 to fill.

**Returns** `Mat4`: The filled Mat4.

### invert

```ts
invert(): Transform
```

Inverts this transform in-place.

**Returns** [`Transform`](https://api.playcanvas.com/splat-transform/classes/Transform.md): This transform (for chaining).

### isIdentity

```ts
isIdentity(epsilon?: number): boolean
```

Tests whether this transform is effectively identity within the given tolerance.

**Parameters**

- `epsilon` (`number`, optional, default `1e-6`): Floating-point tolerance. Defaults to 1e-6.

**Returns** `boolean`: True if identity within the tolerance.

### mul

```ts
mul(other: Transform): Transform
```

Sets this transform to this * other.

**Parameters**

- `other` ([`Transform`](https://api.playcanvas.com/splat-transform/classes/Transform.md)): The transform to multiply with.

**Returns** [`Transform`](https://api.playcanvas.com/splat-transform/classes/Transform.md): This transform (for chaining).

### mul2

```ts
mul2(a: Transform, b: Transform): Transform
```

Sets this transform to the composition of a * b. Handles aliasing
(either a or b may be this).

**Parameters**

- `a` ([`Transform`](https://api.playcanvas.com/splat-transform/classes/Transform.md)): The first (left) transform.
- `b` ([`Transform`](https://api.playcanvas.com/splat-transform/classes/Transform.md)): The second (right) transform.

**Returns** [`Transform`](https://api.playcanvas.com/splat-transform/classes/Transform.md): This transform (for chaining).

### transformPoint

```ts
transformPoint(point: Vec3, result: Vec3): Vec3
```

Transforms a point by this TRS transform: result = translation + rotation * (scale * point).

**Parameters**

- `point` (`Vec3`): The input point.
- `result` (`Vec3`): The Vec3 to write the result into (may alias point).

**Returns** `Vec3`: The transformed point.
