7 #include "imstkPlane.h" 8 #include "imstkLogger.h" 15 if (type == DataType::PostTransform)
18 return m_normalPostTransform;
24 Plane::setNormal(
const Vec3d n)
28 if (m_normal == n || n.norm() == 0.0)
32 m_normal = n.normalized();
33 m_transformApplied =
false;
38 Plane::setNormal(
const double x,
const double y,
const double z)
40 this->setNormal(Vec3d(x, y, z));
50 Plane::setWidth(
const double w)
70 if (m_transformApplied)
75 m_normalPostTransform =
m_orientation._transformVector(m_normal);
76 m_transformApplied =
true;
87 Vec3d p4 =
m_position + Vec3d(-0.5, 0.0, -0.5);
89 p1 = (
m_transform * Vec4d(p1[0], p1[1], p1[2], 1.0)).head<3>();
90 p2 = (
m_transform * Vec4d(p2[0], p2[1], p2[2], 1.0)).head<3>();
91 p3 = (
m_transform * Vec4d(p3[0], p3[1], p3[2], 1.0)).head<3>();
92 p4 = (
m_transform * Vec4d(p4[0], p4[1], p4[2], 1.0)).head<3>();
94 min = p1.cwiseMin(p2);
95 min = min.cwiseMin(p3);
96 min = min.cwiseMin(p4);
98 max = p1.cwiseMax(p2);
99 max = max.cwiseMax(p3);
100 max = max.cwiseMax(p4);
Mat4d m_transform
Transformation matrix.
void updatePostTransformData() const override
Apply the global transform to the local parameters producing post transformed parameters.
Quatd m_orientation
orientation
void postModified()
Post modified event.
Vec3d getNormal(DataType type=DataType::PostTransform)
Get/Set the normal to the plane.
void applyTransform(const Mat4d &m) override
Apply a user transform directly to (pre-transformed) parameters producing new parameters.
double m_width
Width of plane, only used for visual purposes.
void computeBoundingBox(Vec3d &min, Vec3d &max, const double paddingPercent=0.0) override
Get the min, max of the AABB around the plane.
void updatePostTransformData() const override
Update the Plane parameters applying the latest transform.
double getWidth()
Get/Set the width of the plane, only used for visual purposes.
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...