Table of Contents

Class TransformedShape

Namespace
Jitter2.Collision.Shapes
Assembly
Jitter2.dll

Represents a shape wrapper defined by an original shape and an affine transformation (translation and linear map).

public class TransformedShape : RigidBodyShape, IDynamicTreeProxy, IPartitionedSetIndex, IUpdatableBoundingBox, ISupportMappable, IRayCastable, ISweepTestable, IDistanceTestable
Inheritance
TransformedShape
Implements
Inherited Members

Constructors

TransformedShape(RigidBodyShape, JMatrix)

Constructs a transformed shape with a linear transformation (rotation, scale, or shear), assuming zero translation.

public TransformedShape(RigidBodyShape shape, JMatrix transform)

Parameters

shape RigidBodyShape
transform JMatrix

TransformedShape(RigidBodyShape, JVector)

Constructs a transformed shape with a translation (offset), assuming identity rotation/scale.

public TransformedShape(RigidBodyShape shape, JVector translation)

Parameters

shape RigidBodyShape
translation JVector

TransformedShape(RigidBodyShape, in JVector, in JMatrix)

Constructs a transformed shape through an affine transformation defined by a linear map and a translation.

public TransformedShape(RigidBodyShape shape, in JVector translation, in JMatrix transform)

Parameters

shape RigidBodyShape
translation JVector
transform JMatrix

Properties

OriginalShape

Gets the original shape that is being transformed.

public RigidBodyShape OriginalShape { get; }

Property Value

RigidBodyShape

Transformation

Gets or sets the linear transformation (rotation, scale, or shear) applied to the shape.

public JMatrix Transformation { get; set; }

Property Value

JMatrix

Translation

Gets or sets the translation applied to the shape.

public JVector Translation { get; set; }

Property Value

JVector

Methods

CalculateBoundingBox(in JQuaternion, in JVector, out JBoundingBox)

public override void CalculateBoundingBox(in JQuaternion orientation, in JVector position, out JBoundingBox box)

Parameters

orientation JQuaternion
position JVector
box JBoundingBox

CalculateMassInertia(out JMatrix, out JVector, out float)

Calculates the mass and inertia of the shape. Can be overridden by child classes to improve performance or accuracy. The default implementation relies on an approximation of the shape constructed using the support map function.

public override void CalculateMassInertia(out JMatrix inertia, out JVector com, out float mass)

Parameters

inertia JMatrix
com JVector
mass float

Remarks

The inertia tensor is computed relative to the coordinate system origin (0,0,0), not the center of mass.

GetCenter(out JVector)

Computes a point deep within the shape, used as an initial search point in GJK-based algorithms.

public override void GetCenter(out JVector point)

Parameters

point JVector

A point guaranteed to be inside the convex hull, typically the center of mass.

SupportMap(in JVector, out JVector)

Computes the point on the shape that is furthest in the specified direction.

public override void SupportMap(in JVector direction, out JVector result)

Parameters

direction JVector

The search direction in local space. Does not need to be normalized.

result JVector

The point on the shape's surface furthest along direction.