Skip to content

CapsuleShape

class CapsuleShape : public Shape

A capsule shape, defined by a radius and an height.

Operators

Name Description
operator== Compares this shape with another shape for equality.
operator!= Compares this shape with another shape for inequality.

Functions

Name Description
Create Creates a new CapsuleShape from a definition.
CapsuleShape Constructs a new CapsuleShape.
GetRadius Gets the radius of the capsule shape.
GetHalfHeight Gets the half height of the capsule shape.
GetDiameter Gets the diameter of the capsule shape.
GetHeight Gets the height of the capsule shape.
SetRadius Sets the radius of the capsule shape.
SetHalfHeight Sets the half height of the capsule shape.
GetShortestDistanceToEdge Gets the shortest distance to the edge of this shape.
Contains Checks if the given position is contained in this shape.

Operator Details

operator!=

bool operator!=(const CapsuleShape& other) const

Compares this shape with another shape for inequality.

Note

Shapes are equal if they have the same dimensions, the position, and the same orientation.

Parameter other
The other shape to compare with.
Return
false if the shapes are equal, true otherwise.

operator==

bool operator==(const CapsuleShape& other) const

Compares this shape with another shape for equality.

Note

Shapes are equal if they have the same dimensions, the position, and the same orientation.

Parameter other
The other shape to compare with.
Return
true if the shapes are equal, false otherwise.

Function Details

CapsuleShape

explicit CapsuleShape(AmReal32 radius, AmReal32 halfHeight)

Constructs a new CapsuleShape.

Parameter radius
The capsule radius.
Parameter halfHeight
The capsule half height.

Contains

[[nodiscard]] bool Contains(const AmVec3& location) final

Checks if the given position is contained in this shape.

Parameter location
The 3D position to check.
Return
true if the shape contains the given position, false otherwise.

Create

static CapsuleShape* Create(const CapsuleShapeDefinition* definition)

Creates a new CapsuleShape from a definition.

Parameter definition
The definition of the shape generated from a flatbuffer binary.

Warning

This method is intended for internal usage only.

GetDiameter

[[nodiscard]] AmReal32 GetDiameter() const

Gets the diameter of the capsule shape.

Return
The capsule's diameter.

GetHalfHeight

[[nodiscard]] AmReal32 GetHalfHeight() const

Gets the half height of the capsule shape.

Return
The capsule's half height.

GetHeight

[[nodiscard]] AmReal32 GetHeight() const

Gets the height of the capsule shape.

Return
The capsule's height.

GetRadius

[[nodiscard]] AmReal32 GetRadius() const

Gets the radius of the capsule shape.

Return
The capsule's radius.

GetShortestDistanceToEdge

[[nodiscard]] AmReal32 GetShortestDistanceToEdge(const AmVec3& location) final

Gets the shortest distance to the edge of this shape.

Parameter location
The location from which calculate the distance.
Return
The shortest distance from the location to the edge of this shape. If negative, the given location in outside the shape.

SetHalfHeight

void SetHalfHeight(AmReal32 halfHeight)

Sets the half height of the capsule shape.

Parameter halfHeight
The capsule's half height.

SetRadius

void SetRadius(AmReal32 radius)

Sets the radius of the capsule shape.

Parameter radius
The capsule's radius.