7 #include "imstkAnalyticalGeometry.h" 8 #include "imstkLogger.h" 12 AnalyticalGeometry::AnalyticalGeometry() : ImplicitGeometry(),
13 m_position(Vec3d::Zero()), m_positionPostTransform(Vec3d::Zero()),
14 m_orientation(Quatd::Identity()), m_orientationPostTransform(Quatd::Identity())
21 LOG(INFO) <<
"Position: (" <<
22 m_position.x() <<
", " <<
23 m_position.y() <<
", " <<
24 m_position.z() <<
")";
25 LOG(INFO) <<
"Orientation: (" <<
26 m_orientation.x() <<
", " <<
27 m_orientation.y() <<
", " <<
28 m_orientation.z() <<
", " <<
35 if (type == DataType::PostTransform)
37 this->updatePostTransformData();
38 return m_positionPostTransform;
52 m_transformApplied =
false;
59 this->setPosition(Vec3d(x, y, z));
65 if (type == DataType::PostTransform)
67 this->updatePostTransformData();
68 return m_orientationPostTransform;
78 if (m_orientation.coeffs() == r.coeffs())
84 m_transformApplied =
false;
91 this->setPosition((m * Vec4d(m_position[0], m_position[1], m_position[2], 1.0)).head<3>());
92 this->setOrientation((m_orientation * Quatd(m.block<3, 3>(0, 0))).normalized());
98 m_positionPostTransform = (m_transform * Vec4d(m_position[0], m_position[1], m_position[2], 1.0)).head<3>();
99 m_orientationPostTransform = (Quatd(getRotation()) * m_orientation).normalized();
Quatd getOrientation(DataType type=DataType::PostTransform)
Get the local or global orientation (post transformed)
void updatePostTransformData() const override
Apply the global transform to the local parameters producing post transformed parameters.
Vec3d getPosition(DataType type=DataType::PostTransform)
Get the local or global position (post transformed)
void print() const override
Print.
void setPosition(const Vec3d p)
Set the local position.
void setOrientation(const Quatd r)
Set the local orientation.
void applyTransform(const Mat4d &m) override
Apply a user transform directly to (pre-transformed) parameters producing new parameters.
DataType
Enumeration for the data to retrieve PreTransform for data where transform matrix is not applied Po...