# GeomInterface

> Class

Inheritance

* [object](https://learn.microsoft.com/dotnet/api/system.object)
* [Interface](./api_interface)
* GeomInterface

***

Inherited Members

* [Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\))

* [Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\))

* [GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

* [GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype)

* [MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

* [ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)

* [ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

***

Namespace: UnityEngine.Pixyz.Geom

```csharp
public class GeomInterface : Interface
```

## Fields

### IdentityMatrix4

```csharp
public static readonly Matrix4 IdentityMatrix4
```

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### XupToYupMatrix4

```csharp
public static readonly Matrix4 XupToYupMatrix4
```

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### YupToZupMatrix4

```csharp
public static readonly Matrix4 YupToZupMatrix4
```

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### ZupToYupMatrix4

```csharp
public static readonly Matrix4 ZupToYupMatrix4
```

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

## Methods

### GetLastError

```csharp
public static string GetLastError()
```

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### ApplyTransform

Apply a transformation matrix to a geometrical entity.

```csharp
[HandleProcessCorruptedStateExceptions]
public void ApplyTransform(uint entity, Matrix4 matrix)
```

Parameters

| Type                                                         | Name   | Description                |
| ------------------------------------------------------------ | ------ | -------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | entity | The geometric entity.      |
| [Matrix4](./geom_matrix4)                                    | matrix | The transformation matrix. |

### ConfigureFunctionLogger

```csharp
[HandleProcessCorruptedStateExceptions]
public void ConfigureFunctionLogger(string functionName, bool enableFunction, bool enableParameters, bool enableExecutionTime)
```

Parameters

| Type                                                           | Name                | Description |
| -------------------------------------------------------------- | ------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | functionName        |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableFunction      |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableParameters    |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableExecutionTime |             |

### GetEntityAABB

Retrieve the Axis-Aligned Bounded Box of a geometric entity.

```csharp
[HandleProcessCorruptedStateExceptions]
public AABB GetEntityAABB(uint entity)
```

Parameters

| Type                                                         | Name   | Description           |
| ------------------------------------------------------------ | ------ | --------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | entity | The geometric entity. |

Returns

| Type                | Description |
| ------------------- | ----------- |
| [AABB](./geom_aabb) |             |

### ChangeOfBasisMatrix

Construct a Change of Basis Matrix (e.g multiplying the point \[0,0,0] will result to the point origin).

```csharp
[HandleProcessCorruptedStateExceptions]
public Matrix4 ChangeOfBasisMatrix(Point3 origin, Point3 x, Point3 y, Point3 z)
```

Parameters

| Type                    | Name   | Description              |
| ----------------------- | ------ | ------------------------ |
| [Point3](./geom_point3) | origin | Origin of the new basis. |
| [Point3](./geom_point3) | x      | X axis of the new basis. |
| [Point3](./geom_point3) | y      | Y axis of the new basis. |
| [Point3](./geom_point3) | z      | Z axis of the new basis. |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### DecomposeTransform

Decompose a Matrix4 into translation, scale and rotation through Quaternion.

```csharp
[HandleProcessCorruptedStateExceptions]
public DecomposeTransformReturn DecomposeTransform(Matrix4 matrix)
```

Parameters

| Type                      | Name   | Description |
| ------------------------- | ------ | ----------- |
| [Matrix4](./geom_matrix4) | matrix |             |

Returns

| Type                                                        | Description |
| ----------------------------------------------------------- | ----------- |
| [DecomposeTransformReturn](./geom_decomposetransformreturn) |             |

### FromAffine

Create a Matrix from an Affine.

```csharp
[HandleProcessCorruptedStateExceptions]
public Matrix4 FromAffine(Affine affine)
```

Parameters

| Type                    | Name   | Description |
| ----------------------- | ------ | ----------- |
| [Affine](./geom_affine) | affine | The affine. |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### FromLookAtMatrix

Get camera position, up and target vectors.

```csharp
[HandleProcessCorruptedStateExceptions]
public FromLookAtMatrixReturn FromLookAtMatrix(Matrix4 matrix, double distanceFromTarget = 1)
```

Parameters

| Type                                                           | Name               | Description         |
| -------------------------------------------------------------- | ------------------ | ------------------- |
| [Matrix4](./geom_matrix4)                                      | matrix             | The created Matrix. |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | distanceFromTarget |                     |

Returns

| Type                                                    | Description |
| ------------------------------------------------------- | ----------- |
| [FromLookAtMatrixReturn](./geom_fromlookatmatrixreturn) |             |

### FromOriginNormal

Create a Matrix from an origin and a normal vector.

```csharp
[HandleProcessCorruptedStateExceptions]
public Matrix4 FromOriginNormal(Point3 origin, Point3 normal)
```

Parameters

| Type                    | Name   | Description        |
| ----------------------- | ------ | ------------------ |
| [Point3](./geom_point3) | origin | The origin point.  |
| [Point3](./geom_point3) | normal | The normal vector. |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### FromTRS

Create a Matrix from translation, rotation and scaling vectors.

```csharp
[HandleProcessCorruptedStateExceptions]
public Matrix4 FromTRS(Point3 T, Point3 R, Point3 S)
```

Parameters

| Type                    | Name | Description                    |
| ----------------------- | ---- | ------------------------------ |
| [Point3](./geom_point3) | T    | The translation vector.        |
| [Point3](./geom_point3) | R    | The rotation vector (degrees). |
| [Point3](./geom_point3) | S    | The scaling vector.            |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### GetMaxScale

Get maximum matrix scale.

```csharp
[HandleProcessCorruptedStateExceptions]
public double GetMaxScale(Matrix4 matrix)
```

Parameters

| Type                      | Name   | Description |
| ------------------------- | ------ | ----------- |
| [Matrix4](./geom_matrix4) | matrix |             |

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [double](https://learn.microsoft.com/dotnet/api/system.double) |             |

### InvertMatrix

Invert a matrix.

```csharp
[HandleProcessCorruptedStateExceptions]
public Matrix4 InvertMatrix(Matrix4 matrix)
```

Parameters

| Type                      | Name   | Description           |
| ------------------------- | ------ | --------------------- |
| [Matrix4](./geom_matrix4) | matrix | The matrix to invert. |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### LookAtMatrix

Create a matrix from a camera position, up and target.

```csharp
[HandleProcessCorruptedStateExceptions]
public Matrix4 LookAtMatrix(Point3 position, Point3 up, Point3 target)
```

Parameters

| Type                    | Name     | Description          |
| ----------------------- | -------- | -------------------- |
| [Point3](./geom_point3) | position | The camera position. |
| [Point3](./geom_point3) | up       | The up vector.       |
| [Point3](./geom_point3) | target   | The target position. |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### MatrixToQuaternion

Get the quaternion of a Matrix4.

```csharp
[HandleProcessCorruptedStateExceptions]
public Point4 MatrixToQuaternion(Matrix4 matrix)
```

Parameters

| Type                      | Name   | Description |
| ------------------------- | ------ | ----------- |
| [Matrix4](./geom_matrix4) | matrix |             |

Returns

| Type                    | Description |
| ----------------------- | ----------- |
| [Point4](./geom_point4) |             |

### MultiplyMatrices

Multiply two matrices, returns left\*right.

```csharp
[HandleProcessCorruptedStateExceptions]
public Matrix4 MultiplyMatrices(Matrix4 left, Matrix4 right)
```

Parameters

| Type                      | Name  | Description        |
| ------------------------- | ----- | ------------------ |
| [Matrix4](./geom_matrix4) | left  | Left side matrix.  |
| [Matrix4](./geom_matrix4) | right | Right side matrix. |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### MultiplyMatrixPoint

Multiply a point by a matrix (i.e apply the matrix to a point).

```csharp
[HandleProcessCorruptedStateExceptions]
public Point3 MultiplyMatrixPoint(Matrix4 matrix, Point3 point)
```

Parameters

| Type                      | Name   | Description            |
| ------------------------- | ------ | ---------------------- |
| [Matrix4](./geom_matrix4) | matrix | The matrix to apply.   |
| [Point3](./geom_point3)   | point  | The point to multiply. |

Returns

| Type                    | Description |
| ----------------------- | ----------- |
| [Point3](./geom_point3) |             |

### MultiplyMatrixVector

Multiply a vector by a matrix (i.e apply the matrix to a vector).

```csharp
[HandleProcessCorruptedStateExceptions]
public Point3 MultiplyMatrixVector(Matrix4 matrix, Point3 vector)
```

Parameters

| Type                      | Name   | Description             |
| ------------------------- | ------ | ----------------------- |
| [Matrix4](./geom_matrix4) | matrix | The matrix to apply.    |
| [Point3](./geom_point3)   | vector | The vector to multiply. |

Returns

| Type                    | Description |
| ----------------------- | ----------- |
| [Point3](./geom_point3) |             |

### OrthographicMatrix

Create an orthographic matrix from a 3D width, a 3D height, a near, and a far clipping distance.

```csharp
[HandleProcessCorruptedStateExceptions]
public Matrix4 OrthographicMatrix(double width3D, double height3D, double nearClipDistance, double farClipDistance)
```

Parameters

| Type                                                           | Name             | Description                 |
| -------------------------------------------------------------- | ---------------- | --------------------------- |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | width3D          | The 3D width to consider.   |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | height3D         | The 3D height to consider.  |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | nearClipDistance | The near clipping distance. |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | farClipDistance  | The far clipping distance.  |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### PerspectiveMatrix

Create a perspective matrix from a fovX, an aspect ratio, a near, and a far clipping distance.

```csharp
[HandleProcessCorruptedStateExceptions]
public Matrix4 PerspectiveMatrix(double fovX, double aspectRatio, double nearClipDistance, double farClipDistance)
```

Parameters

| Type                                                           | Name             | Description                      |
| -------------------------------------------------------------- | ---------------- | -------------------------------- |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | fovX             | The field of view on the x axis. |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | aspectRatio      | The aspect ratio foxX/fovY.      |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | nearClipDistance | The near clipping distance.      |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | farClipDistance  | The far clipping distance.       |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### QuaternionToMatrix

Returns the quaternion as a Matrix4.

```csharp
[HandleProcessCorruptedStateExceptions]
public Matrix4 QuaternionToMatrix(Point4 quaternion)
```

Parameters

| Type                    | Name       | Description |
| ----------------------- | ---------- | ----------- |
| [Point4](./geom_point4) | quaternion |             |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [Matrix4](./geom_matrix4) |             |

### ToTRS

Decompose a Matrix into translation, rotation and scaling vectors.

```csharp
[HandleProcessCorruptedStateExceptions]
public Vector3List ToTRS(Matrix4 matrix)
```

Parameters

| Type                      | Name   | Description                  |
| ------------------------- | ------ | ---------------------------- |
| [Matrix4](./geom_matrix4) | matrix | The Matrix to be decomposed. |

Returns

| Type                              | Description |
| --------------------------------- | ----------- |
| [Vector3List](./geom_vector3list) |             |
