]> git.tdb.fi Git - libs/math.git/commitdiff
Add a Sphere convenience class
authorMikko Rasa <tdb@tdb.fi>
Sun, 26 Jan 2025 16:53:25 +0000 (18:53 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 26 Jan 2025 16:53:25 +0000 (18:53 +0200)
For some reason this was missing even though there's Rectangle, Box and
Circle.

source/geometry/sphere.h [new file with mode: 0644]

diff --git a/source/geometry/sphere.h b/source/geometry/sphere.h
new file mode 100644 (file)
index 0000000..9c87ad5
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef MSP_GEOMETRY_SPHERE_H_
+#define MSP_GEOMETRY_SPHERE_H_
+
+#include "hypersphere.h"
+
+namespace Msp {
+namespace Geometry {
+
+/**
+The three-dimensional special case of a HyperSphere.  This class exists for
+convenience only and does not provide any extra functionality over the base
+class.
+*/
+template<typename T>
+class Sphere: public HyperSphere<T, 3>
+{
+public:
+       Sphere() = default;
+       explicit Sphere(T r): HyperSphere<T, 3>(r) { }
+};
+
+} // namespace Geometry
+} // namespace Msp
+
+#endif