From 5a377a568eb884f16a4b2a12e67d916fe8343359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 11 Apr 2013 12:58:16 +0200 Subject: [PATCH] Physics: default constructors for shapes. --- src/Physics/AxisAlignedBox.h | 7 +++++++ src/Physics/Box.h | 7 +++++++ src/Physics/Capsule.h | 7 +++++++ src/Physics/Line.h | 7 +++++++ src/Physics/LineSegment.h | 7 +++++++ src/Physics/Plane.h | 7 +++++++ src/Physics/Point.h | 7 +++++++ src/Physics/Sphere.h | 7 +++++++ 8 files changed, 56 insertions(+) diff --git a/src/Physics/AxisAlignedBox.h b/src/Physics/AxisAlignedBox.h index d987c8674..1a0a1e6d7 100644 --- a/src/Physics/AxisAlignedBox.h +++ b/src/Physics/AxisAlignedBox.h @@ -46,6 +46,13 @@ radius. */ template class MAGNUM_PHYSICS_EXPORT AxisAlignedBox: public AbstractShape { public: + /** + * @brief Default constructor + * + * Creates zero sized box positioned at origin. + */ + inline explicit AxisAlignedBox() {} + /** @brief Constructor */ inline explicit AxisAlignedBox(const typename DimensionTraits::VectorType& min, const typename DimensionTraits::VectorType& max): _min(min), _max(max), _transformedMin(min), _transformedMax(max) {} diff --git a/src/Physics/Box.h b/src/Physics/Box.h index e0b79de96..cf7276187 100644 --- a/src/Physics/Box.h +++ b/src/Physics/Box.h @@ -47,6 +47,13 @@ radius. */ template class MAGNUM_PHYSICS_EXPORT Box: public AbstractShape { public: + /** + * @brief Default constructor + * + * Creates zero-sized box positioned at origin. + */ + inline explicit Box(): _transformation(DimensionTraits::MatrixType::Zero), _transformedTransformation(DimensionTraits::MatrixType::Zero) {} + /** @brief Constructor */ inline explicit Box(const typename DimensionTraits::MatrixType& transformation): _transformation(transformation), _transformedTransformation(transformation) {} diff --git a/src/Physics/Capsule.h b/src/Physics/Capsule.h index bdb9975d7..7880a7102 100644 --- a/src/Physics/Capsule.h +++ b/src/Physics/Capsule.h @@ -46,6 +46,13 @@ applying transformation, the scale factor is averaged from all axes. */ template class MAGNUM_PHYSICS_EXPORT Capsule: public AbstractShape { public: + /** + * @brief Constructor + * + * Creates zero-sized capsule at origin. + */ + inline explicit Capsule(): _radius(0.0f), _transformedRadius(0.0f) {} + /** @brief Constructor */ inline explicit Capsule(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b, Float radius): _a(a), _transformedA(a), _b(b), _transformedB(b), _radius(radius), _transformedRadius(radius) {} diff --git a/src/Physics/Line.h b/src/Physics/Line.h index 0c9abb333..bfb9bdceb 100644 --- a/src/Physics/Line.h +++ b/src/Physics/Line.h @@ -43,6 +43,13 @@ namespace Magnum { namespace Physics { */ template class MAGNUM_PHYSICS_EXPORT Line: public AbstractShape { public: + /** + * @brief Default constructor + * + * Creates line with both points at origin. + */ + inline explicit Line() {} + /** @brief Constructor */ inline explicit Line(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b): _a(a), _transformedA(a), _b(b), _transformedB(b) {} diff --git a/src/Physics/LineSegment.h b/src/Physics/LineSegment.h index ab1684480..666764734 100644 --- a/src/Physics/LineSegment.h +++ b/src/Physics/LineSegment.h @@ -39,6 +39,13 @@ namespace Magnum { namespace Physics { */ template class LineSegment: public Line { public: + /** + * @brief Default constructor + * + * Creates line segment with both points at origin. + */ + inline explicit LineSegment() {} + /** @brief Constructor */ inline explicit LineSegment(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b): Line(a, b) {} diff --git a/src/Physics/Plane.h b/src/Physics/Plane.h index 7dbf76e22..fbb576eb6 100644 --- a/src/Physics/Plane.h +++ b/src/Physics/Plane.h @@ -39,6 +39,13 @@ namespace Magnum { namespace Physics { /** @brief Infinite plane, defined by position and normal (3D only) */ class MAGNUM_PHYSICS_EXPORT Plane: public AbstractShape<3> { public: + /** + * @brief Default constructor + * + * Creates plane with zero-sized normal at origin. + */ + inline explicit Plane() {} + /** @brief Constructor */ inline explicit Plane(const Vector3& position, const Vector3& normal): _position(position), _transformedPosition(position), _normal(normal), _transformedNormal(normal) {} diff --git a/src/Physics/Point.h b/src/Physics/Point.h index 2ab8f362e..606ad0b51 100644 --- a/src/Physics/Point.h +++ b/src/Physics/Point.h @@ -42,6 +42,13 @@ namespace Magnum { namespace Physics { */ template class MAGNUM_PHYSICS_EXPORT Point: public AbstractShape { public: + /** + * @brief Default constructor + * + * Creates point at origin. + */ + inline explicit Point() {} + /** @brief Constructor */ inline explicit Point(const typename DimensionTraits::VectorType& position): _position(position), _transformedPosition(position) {} diff --git a/src/Physics/Sphere.h b/src/Physics/Sphere.h index c1324c550..6f83d2ddb 100644 --- a/src/Physics/Sphere.h +++ b/src/Physics/Sphere.h @@ -46,6 +46,13 @@ applying transformation, the scale factor is averaged from all axes. */ template class MAGNUM_PHYSICS_EXPORT Sphere: public AbstractShape { public: + /** + * @brief Default constructor + * + * Creates zero-sized sphere at origin. + */ + inline explicit Sphere(): _radius(0.0f), _transformedRadius(0.0f) {} + /** @brief Constructor */ inline explicit Sphere(const typename DimensionTraits::VectorType& position, Float radius): _position(position), _transformedPosition(position), _radius(radius), _transformedRadius(radius) {}