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

Sphere defined by position and radius.

Unlike other elements the sphere expects uniform scaling. See Collision detection for brief introduction.

Derived classes

template<UnsignedInt dimensions>
class InvertedSphere deprecated
Inverted sphere defined by position and radius.

Public types

enum (anonymous): UnsignedInt { Dimensions = dimensions }

Constructors, destructors, conversion operators

Sphere() constexpr
Default constructor.
Sphere(const VectorTypeFor<dimensions, Float>& position, Float radius) constexpr
Constructor.

Public functions

auto transformed(const MatrixTypeFor<dimensions, Float>& matrix) const -> Sphere<dimensions>
Transformed shape.
auto position() const -> VectorTypeFor<dimensions, Float> constexpr
Position.
void setPosition(const VectorTypeFor<dimensions, Float>& position)
Set position.
auto radius() const -> Float constexpr
Radius.
void setRadius(Float radius)
Set radius.
auto operator%(const Point<dimensions>& other) const -> bool
Collision occurence with point.
auto operator/(const Point<dimensions>& other) const -> Collision<dimensions>
Collision with point.
auto operator%(const Line<dimensions>& other) const -> bool
Collision occurence with line.
auto operator%(const LineSegment<dimensions>& other) const -> bool
Collision occurence with line segment.
auto operator%(const Sphere<dimensions>& other) const -> bool
Collision occurence with sphere.
auto operator/(const Sphere<dimensions>& other) const -> Collision<dimensions>
Collision with sphere.

Enum documentation

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

Enumerators
Dimensions

Dimension count

Function documentation

template<UnsignedInt dimensions>
Magnum::Shapes::Sphere<dimensions>::Sphere() constexpr

Default constructor.

Creates zero-sized sphere at origin.

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

Collision occurence of Sphere and Capsule.

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

Collision occurence of Sphere and Cylinder.

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

Collision occurence of Sphere and InvertedSphere.

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

Collision of Sphere and InvertedSphere.