diff options
-rw-r--r-- | libdimensionxx/dimensionxx/object.hpp | 5 | ||||
-rw-r--r-- | libdimensionxx/object.cpp | 12 | ||||
-rw-r--r-- | libdimensionxx/objects.cpp | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/libdimensionxx/dimensionxx/object.hpp b/libdimensionxx/dimensionxx/object.hpp index 6eaca83..af9bbcd 100644 --- a/libdimensionxx/dimensionxx/object.hpp +++ b/libdimensionxx/dimensionxx/object.hpp @@ -32,6 +32,11 @@ namespace Dimension // No-op, made pure virtual virtual ~Object() = 0; + // Get/set the transformation matrix + Matrix trans(); + void trans(const Matrix& trans); + + // Object callbacks virtual Array<double> intersections(const Line& l); virtual bool inside(const Vector& point); diff --git a/libdimensionxx/object.cpp b/libdimensionxx/object.cpp index 61a887c..7d66206 100644 --- a/libdimensionxx/object.cpp +++ b/libdimensionxx/object.cpp @@ -26,6 +26,18 @@ namespace Dimension Object::~Object() { } + Matrix + Object::trans() + { + return Matrix(m_object->trans); + } + + void + Object::trans(const Matrix& trans) + { + m_object->trans = trans.dmnsn(); + } + // Intersection list for the line l Array<double> Object::intersections(const Line& l) diff --git a/libdimensionxx/objects.cpp b/libdimensionxx/objects.cpp index 1a63494..1b78731 100644 --- a/libdimensionxx/objects.cpp +++ b/libdimensionxx/objects.cpp @@ -42,7 +42,7 @@ namespace Dimension : Object(dmnsn_new_cube()) { if (!m_object) { - throw Dimension_Error("Failed to allocate sphere."); + throw Dimension_Error("Failed to allocate cube."); } } |