Table of Contents

Class CylinderShape

Namespace
Jitter2.Collision.Shapes
Assembly
Jitter2.dll

Represents a cylinder shape defined by a height and radius.

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

Constructors

CylinderShape(float, float)

Initializes a new instance of the CylinderShape class, creating a cylinder shape with the specified height and radius. The symmetry axis of the cylinder is aligned along the y-axis.

public CylinderShape(float height, float radius)

Parameters

height float

The height of the cylinder.

radius float

The radius of the cylinder at its base.

Exceptions

ArgumentOutOfRangeException

Thrown when height or radius is less than or equal to zero.

Properties

Height

Gets or sets the height of the cylinder.

public float Height { get; set; }

Property Value

float

Exceptions

ArgumentOutOfRangeException

Thrown when value is less than or equal to zero.

Radius

Gets or sets the radius of the cylinder.

public float Radius { get; set; }

Property Value

float

Exceptions

ArgumentOutOfRangeException

Thrown when value is less than or equal to zero.

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.