Geom
Python API functions
Read time 7 minutesLast updated 19 hours ago
applyTransform
Apply a transformation matrix to a geometrical entity.
geom.applyTransform(entity, matrix=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]])
Parameters
Type | Name | Description |
|---|
| GeomEntity | entity | The geometric entity. |
| Matrix4 | matrix | The transformation matrix. |
configureFunctionLogger
geom.configureFunctionLogger(functionName, enableFunction, enableParameters, enableExecutionTime)
Parameters
getEntityAABB
Retrieve the Axis-Aligned Bounded Box of a geometric entity.
geom.getEntityAABB(entity) -> geom.AABB
Parameters
Type | Name | Description |
|---|
| GeomEntity | entity | The geometric entity. |
Returns
Type | Name | Description |
|---|
| AABB | aabb | The axis aligned bounded box. |
Math
changeOfBasisMatrix
Construct a Change of Basis Matrix (e.g multiplying the point [0,0,0] will result to the point origin).
geom.changeOfBasisMatrix(origin, x, y, z) -> geom.Matrix4
Parameters
Type | Name | Description |
|---|
| Point3 | origin | Origin of the new basis. |
| Vector3 | x | X axis of the new basis. |
| Vector3 | y | Y axis of the new basis. |
| Vector3 | z | Z axis of the new basis. |
Returns
Type | Name | Description |
|---|
| Matrix4 | changeOfBasis | The change of basis matrix. |
See also:
fromAffine
Create a Matrix from an Affine.
geom.fromAffine(affine) -> geom.Matrix4
Parameters
Type | Name | Description |
|---|
| Affine | affine | The affine. |
Returns
Type | Name | Description |
|---|
| Matrix4 | matrix | The created Matrix. |
See also:
fromLookAtMatrix
Get camera position, up and target vectors.
geom.fromLookAtMatrix(matrix, distanceFromTarget=1) -> geom.Point3, geom.Vector3, geom.Point3
Parameters
Type | Name | Description |
|---|
| Matrix4 | matrix | The created Matrix. |
| Distance | distanceFromTarget | |
Returns
Type | Name | Description |
|---|
| Point3 | position | The camera position. |
| Vector3 | up | The up vector. |
| Point3 | target | The target position. |
See also:
fromOriginNormal
Create a Matrix from an origin and a normal vector.
geom.fromOriginNormal(origin, normal) -> geom.Matrix4
Parameters
Type | Name | Description |
|---|
| Point3 | origin | The origin point. |
| Vector3 | normal | The normal vector. |
Returns
Type | Name | Description |
|---|
| Matrix4 | matrix | The created Matrix. |
See also:
fromTRS
Create a Matrix from translation, rotation and scaling vectors.
geom.fromTRS(T, R, S) -> geom.Matrix4
Parameters
Type | Name | Description |
|---|
| Vector3 | T | The translation vector. |
| Vector3 | R | The rotations vector. |
| Vector3 | S | The scaling vector. |
Returns
Type | Name | Description |
|---|
| Matrix4 | matrix | The created Matrix. |
See also:
getMaxScale
Get maximum matrix scale.
geom.getMaxScale(matrix) -> core.Double
Parameters
Returns
Type | Name | Description |
|---|
| Double | scale | Max scale value. |
See also:
invertMatrix
Invert a matrix.
geom.invertMatrix(matrix=geom.IdentityMatrix4) -> geom.Matrix4
Parameters
Type | Name | Description |
|---|
| Matrix4 | matrix | The matrix to invert. |
Returns
Type | Name | Description |
|---|
| Matrix4 | inverted | The inverted matrix. |
See also:
lookAtMatrix
Create a matrix from a camera position, up and target.
geom.lookAtMatrix(position, up, target) -> geom.Matrix4
Parameters
Type | Name | Description |
|---|
| Point3 | position | The camera position. |
| Vector3 | up | The up vector. |
| Point3 | target | The target position. |
Returns
Type | Name | Description |
|---|
| Matrix4 | matrix | The created matrix. |
See also:
multiplyMatrices
Multiply two matrices, returns left*right.
geom.multiplyMatrices(left=geom.IdentityMatrix4, right=geom.IdentityMatrix4) -> geom.Matrix4
Parameters
Type | Name | Description |
|---|
| Matrix4 | left | Left side matrix. |
| Matrix4 | right | Right side matrix. |
Returns
Type | Name | Description |
|---|
| Matrix4 | result | Result of the matrices multiplication. |
See also:
multiplyMatrixPoint
Multiply a point by a matrix (i.e apply the matrix to a point).
geom.multiplyMatrixPoint(matrix=geom.IdentityMatrix4, point) -> geom.Point3
Parameters
Type | Name | Description |
|---|
| Matrix4 | matrix | The matrix to apply. |
| Point3 | point | The point to multiply. |
Returns
Type | Name | Description |
|---|
| Point3 | result | The resulting point. |
See also:
multiplyMatrixVector
Multiply a vector by a matrix (i.e apply the matrix to a vector).
geom.multiplyMatrixVector(matrix=geom.IdentityMatrix4, vector) -> geom.Vector3
Parameters
Type | Name | Description |
|---|
| Matrix4 | matrix | The matrix to apply. |
| Vector3 | vector | The vector to multiply. |
Returns
Type | Name | Description |
|---|
| Vector3 | result | The resulting point. |
See also:
orthographicMatrix
Create an orthographic matrix from a 3D width, a 3D height, a near, and a far clipping distance.
geom.orthographicMatrix(width3D, height3D, nearClipDistance, farClipDistance) -> geom.Matrix4
Parameters
Type | Name | Description |
|---|
| Double | width3D | The 3D width to consider. |
| Double | height3D | The 3D height to consider. |
| Distance | nearClipDistance | The near clipping distance. |
| Distance | farClipDistance | The far clipping distance. |
Returns
Type | Name | Description |
|---|
| Matrix4 | matrix | The created matrix. |
See also:
perspectiveMatrix
Create a perspective matrix from a fovX, an aspect ratio, a near, and a far clipping distance.
geom.perspectiveMatrix(fovX, aspectRatio, nearClipDistance, farClipDistance) -> geom.Matrix4
Parameters
Type | Name | Description |
|---|
| Angle | fovX | The field of view on the x axis. |
| Double | aspectRatio | The aspect ratio foxX/fovY. |
| Distance | nearClipDistance | The near clipping distance. |
| Distance | farClipDistance | The far clipping distance. |
Returns
Type | Name | Description |
|---|
| Matrix4 | matrix | The created matrix. |
See also:
toTRS
Decompose a Matrix into translation, rotation and scaling vectors.
geom.toTRS(matrix=geom.IdentityMatrix4) -> geom.Vector3List
Parameters
Type | Name | Description |
|---|
| Matrix4 | matrix | The Matrix to be decomposed. |
Returns
See also:
debug