template<UnsignedInt dimensions>
Magnum::Shapes::AbstractShape class

Base class for object shapes.

This class is not directly instantiable, use Shape instead. See Collision detection for brief introduction.

Base classes

template<UnsignedInt dimensions, class Derived, class T>
class Magnum::SceneGraph::AbstractGroupedFeature
Base for grouped features.

Public types

enum (anonymous): UnsignedInt { Dimensions = dimensions }
enum class Type { Point, Line, LineSegment, Sphere, Capsule, AxisAlignedBox, Box, Composition, Plane }
Shape type.

Constructors, destructors, conversion operators

AbstractShape(SceneGraph::AbstractObject<dimensions, Float>& object, ShapeGroup<dimensions>* group = nullptr) explicit
Constructor.

Public functions

auto group() -> ShapeGroup<dimensions>*
Shape group containing this shape.
auto group() const -> const ShapeGroup<dimensions>*
auto type() const -> Type
Shape type.
auto collides(const AbstractShape<dimensions>& other) const -> bool
Detect collision with other shape.
auto collision(const AbstractShape<dimensions>& other) const -> Collision<dimensions>
Collision with other shape.

Protected functions

void markDirty() override

Enum documentation

template<UnsignedInt dimensions>
enum Magnum::Shapes::AbstractShape<dimensions>::(anonymous): UnsignedInt

Enumerators
Dimensions

Dimension count

template<UnsignedInt dimensions>
enum class Magnum::Shapes::AbstractShape<dimensions>::Type

Shape type.

Enumerators
Point

Point

Line

Line

LineSegment

Line segment

Sphere

Sphere

Capsule

Capsule

AxisAlignedBox

Axis aligned box

Box

Box

Composition

Shape group

Plane

Plane (3D only)

Function documentation

template<UnsignedInt dimensions>
Magnum::Shapes::AbstractShape<dimensions>::AbstractShape(SceneGraph::AbstractObject<dimensions, Float>& object, ShapeGroup<dimensions>* group = nullptr) explicit

Constructor.

Parameters
object Object holding this feature
group Group this shape belongs to

template<UnsignedInt dimensions>
ShapeGroup<dimensions>* Magnum::Shapes::AbstractShape<dimensions>::group()

Shape group containing this shape.

If the shape doesn't belong to any group, returns nullptr.

template<UnsignedInt dimensions>
const ShapeGroup<dimensions>* Magnum::Shapes::AbstractShape<dimensions>::group() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
bool Magnum::Shapes::AbstractShape<dimensions>::collides(const AbstractShape<dimensions>& other) const

Detect collision with other shape.

Default implementation returns false.

template<UnsignedInt dimensions>
Collision<dimensions> Magnum::Shapes::AbstractShape<dimensions>::collision(const AbstractShape<dimensions>& other) const

Collision with other shape.

Default implementation returns empty collision.

template<UnsignedInt dimensions>
void Magnum::Shapes::AbstractShape<dimensions>::markDirty() override protected

Marks also the group as dirty