Magnum::Shapes namespace

Shape library.

Contents

Collision detection system.

This library is built if WITH_SHAPES is enabled when building Magnum. To use this library with CMake, you need to request the Shapes component of the Magnum package and link to the Magnum::Shapes target:

find_package(Magnum REQUIRED Shapes)

# ...
target_link_libraries(your-app Magnum::Shapes)

See Downloading and building, Usage with CMake and Collision detection for more information.

Classes

template<UnsignedInt dimensions>
class AbstractShape
Base class for object shapes.
template<UnsignedInt dimensions>
class AxisAlignedBox
Axis-aligned box.
template<UnsignedInt dimensions>
class Box
Unit-size box with assigned transformation matrix.
template<UnsignedInt dimensions>
class Capsule
Capsule defined by cylinder start and end point and radius.
template<UnsignedInt dimensions>
class Collision
Collision data.
template<UnsignedInt dimensions>
class Composition
Composition of shapes.
template<UnsignedInt dimensions>
class Cylinder
Infinite cylinder defined by line and radius.
template<UnsignedInt dimensions>
class InvertedSphere
Inverted sphere defined by position and radius.
template<UnsignedInt dimensions>
class Line
Infinite line, defined by two points.
template<UnsignedInt dimensions>
class LineSegment
Line segment, defined by starting and ending point.
class Plane
Infinite plane, defined by position and normal (3D only)
template<UnsignedInt dimensions>
class Point
Point.
template<class T>
class Shape
Object shape.
template<UnsignedInt dimensions>
class ShapeGroup
Group of shapes.
template<UnsignedInt dimensions>
class Sphere
Sphere defined by position and radius.

Enums

enum class CompositionOperation: UnsignedByte { Not, And, Or }
Shape operation.

Typedefs

using AbstractShape2D = AbstractShape<2>
Base class for two-dimensional object shapes.
using AbstractShape3D = AbstractShape<3>
Base class for three-dimensional object shapes.
using AxisAlignedBox2D = AxisAlignedBox<2>
Two-dimensional axis-aligned box.
using AxisAlignedBox3D = AxisAlignedBox<3>
Three-dimensional axis-aligned box.
using Box2D = Box<2>
Two-dimensional box.
using Box3D = Box<3>
Three-dimensional box.
using Capsule2D = Capsule<2>
Two-dimensional capsule.
using Capsule3D = Capsule<3>
Three-dimensional capsule.
using Collision2D = Collision<2>
Two-dimensional collision data.
using Collision3D = Collision<3>
Three-dimensional collision data.
using Composition2D = Composition<2>
Two-dimensional shape composition.
using Composition3D = Composition<3>
Three-dimensional shape composition.
using Cylinder2D = Cylinder<2>
Infinite two-dimensional cylinder.
using Cylinder3D = Cylinder<3>
Infinite three-dimensional cylinder.
using Line2D = Line<2>
Infinite two-dimensional line.
using Line3D = Line<3>
Infinite three-dimensional line.
using LineSegment2D = LineSegment<2>
Two-dimensional line segment.
using LineSegment3D = LineSegment<3>
Three-dimensional line segment.
using Point2D = Point<2>
Two-dimensional point.
using Point3D = Point<3>
Three-dimensional point.
using ShapeGroup2D = ShapeGroup<2>
Group of two-dimensional shapes.
using ShapeGroup3D = ShapeGroup<3>
Group of three-dimensional shapes.
using Sphere2D = Sphere<2>
Two-dimensional sphere.
using Sphere3D = Sphere<3>
Three-dimensional sphere.
using InvertedSphere2D = InvertedSphere<2>
Inverted two-dimensional sphere.
using InvertedSphere3D = InvertedSphere<3>
Inverted three-dimensional sphere.

Functions

template<UnsignedInt dimensions>
auto operator%(const Point<dimensions>& a, const AxisAlignedBox<dimensions>& b) -> bool
Collision occurence of Point and AxisAlignedBox.
template<UnsignedInt dimensions>
auto operator%(const Point<dimensions>& a, const Capsule<dimensions>& b) -> bool
Collision occurence of Point and Capsule.
template<UnsignedInt dimensions>
auto operator%(const Sphere<dimensions>& a, const Capsule<dimensions>& b) -> bool
Collision occurence of Sphere and Capsule.
template<UnsignedInt dimensions>
auto operator<<(Debug& debug, typename Composition<dimensions>::Type value) -> Debug&
Debug output operator.
template<UnsignedInt dimensions>
auto operator%(const Point<dimensions>& a, const Cylinder<dimensions>& b) -> bool
Collision occurence of Point and Cylinder.
template<UnsignedInt dimensions>
auto operator%(const Sphere<dimensions>& a, const Cylinder<dimensions>& b) -> bool
Collision occurence of Sphere and Cylinder.
auto operator%(const Line3D& a, const Plane& b) -> bool
Collision occurence of Line and Plane.
auto operator%(const LineSegment3D& a, const Plane& b) -> bool
Collision occurence of LineSegment and Plane.
template<UnsignedInt dimensions>
auto operator%(const Point<dimensions>& a, const Sphere<dimensions>& b) -> bool
Collision occurence of Point and Sphere.
template<UnsignedInt dimensions>
auto operator%(const Point<dimensions>& a, const InvertedSphere<dimensions>& b) -> bool
Collision occurence of Point and InvertedSphere.
template<UnsignedInt dimensions>
auto operator/(const Point<dimensions>& a, const Sphere<dimensions>& b) -> Collision<dimensions>
Collision of Point and Sphere.
template<UnsignedInt dimensions>
auto operator/(const Point<dimensions>& a, const InvertedSphere<dimensions>& b) -> Collision<dimensions>
Collision of Point and InvertedSphere.
template<UnsignedInt dimensions>
auto operator%(const Line<dimensions>& a, const Sphere<dimensions>& b) -> bool
Collision occurence of Line and Sphere.
template<UnsignedInt dimensions>
auto operator%(const LineSegment<dimensions>& a, const Sphere<dimensions>& b) -> bool
Collision occurence of LineSegment and Sphere.
template<UnsignedInt dimensions>
auto operator%(const Sphere<dimensions>& a, const InvertedSphere<dimensions>& b) -> bool
Collision occurence of Sphere and InvertedSphere.
template<UnsignedInt dimensions>
auto operator/(const Sphere<dimensions>& a, const InvertedSphere<dimensions>& b) -> Collision<dimensions>
Collision of Sphere and InvertedSphere.

Enum documentation

enum class Magnum::Shapes::CompositionOperation: UnsignedByte

Shape operation.

Enumerators
Not

Boolean NOT

And

Boolean AND

Or

Boolean OR

Typedef documentation

typedef ShapeGroup<2> Magnum::Shapes::ShapeGroup2D

Group of two-dimensional shapes.

See Shape for more information.

typedef ShapeGroup<3> Magnum::Shapes::ShapeGroup3D

Group of three-dimensional shapes.

See Shape for more information.

Function documentation

template<UnsignedInt dimensions>
bool Magnum::Shapes::operator%(const Point<dimensions>& a, const AxisAlignedBox<dimensions>& b)

Collision occurence of Point and AxisAlignedBox.

template<UnsignedInt dimensions>
bool Magnum::Shapes::operator%(const Point<dimensions>& a, const Capsule<dimensions>& b)

Collision occurence of Point and Capsule.

template<UnsignedInt dimensions>
bool Magnum::Shapes::operator%(const Sphere<dimensions>& a, const Capsule<dimensions>& b)

Collision occurence of Sphere and Capsule.

template<UnsignedInt dimensions>
Debug& Magnum::Shapes::operator<<(Debug& debug, typename Composition<dimensions>::Type value)

Debug output operator.

template<UnsignedInt dimensions>
bool Magnum::Shapes::operator%(const Point<dimensions>& a, const Cylinder<dimensions>& b)

Collision occurence of Point and Cylinder.

template<UnsignedInt dimensions>
bool Magnum::Shapes::operator%(const Sphere<dimensions>& a, const Cylinder<dimensions>& b)

Collision occurence of Sphere and Cylinder.

bool Magnum::Shapes::operator%(const Line3D& a, const Plane& b)

Collision occurence of Line and Plane.

bool Magnum::Shapes::operator%(const LineSegment3D& a, const Plane& b)

Collision occurence of LineSegment and Plane.

template<UnsignedInt dimensions>
bool Magnum::Shapes::operator%(const Point<dimensions>& a, const Sphere<dimensions>& b)

Collision occurence of Point and Sphere.

template<UnsignedInt dimensions>
bool Magnum::Shapes::operator%(const Point<dimensions>& a, const InvertedSphere<dimensions>& b)

Collision occurence of Point and InvertedSphere.

template<UnsignedInt dimensions>
Collision<dimensions> Magnum::Shapes::operator/(const Point<dimensions>& a, const Sphere<dimensions>& b)

Collision of Point and Sphere.

template<UnsignedInt dimensions>
Collision<dimensions> Magnum::Shapes::operator/(const Point<dimensions>& a, const InvertedSphere<dimensions>& b)

Collision of Point and InvertedSphere.

template<UnsignedInt dimensions>
bool Magnum::Shapes::operator%(const Line<dimensions>& a, const Sphere<dimensions>& b)

Collision occurence of Line and Sphere.

template<UnsignedInt dimensions>
bool Magnum::Shapes::operator%(const LineSegment<dimensions>& a, const Sphere<dimensions>& b)

Collision occurence of LineSegment and Sphere.

template<UnsignedInt dimensions>
bool Magnum::Shapes::operator%(const Sphere<dimensions>& a, const InvertedSphere<dimensions>& b)

Collision occurence of Sphere and InvertedSphere.

template<UnsignedInt dimensions>
Collision<dimensions> Magnum::Shapes::operator/(const Sphere<dimensions>& a, const InvertedSphere<dimensions>& b)

Collision of Sphere and InvertedSphere.