diff --git a/Source/Geometry/Analytic/imstkAnalyticalGeometry.cpp b/Source/Geometry/Analytic/imstkAnalyticalGeometry.cpp index 5fd1b4c7c82c1f8ccda63880054b5e025930a01a..2c5ac36dd563c7d8ef27230eb57cd29af94171b9 100644 --- a/Source/Geometry/Analytic/imstkAnalyticalGeometry.cpp +++ b/Source/Geometry/Analytic/imstkAnalyticalGeometry.cpp @@ -102,7 +102,7 @@ AnalyticalGeometry::applyRotation(const Mat3d r) } void -AnalyticalGeometry::updatePostTransformData() +AnalyticalGeometry::updatePostTransformData() const { m_orientationAxisPostTransform = m_transform.rotation() * m_orientationAxis; m_orientationAxisPostTransform.normalize(); diff --git a/Source/Geometry/Analytic/imstkAnalyticalGeometry.h b/Source/Geometry/Analytic/imstkAnalyticalGeometry.h index e643ca5f13a93940781c3a3fe32a348e732b48f9..f9919f1126bafe2eeadcfc7387b0f80e118ab9b3 100644 --- a/Source/Geometry/Analytic/imstkAnalyticalGeometry.h +++ b/Source/Geometry/Analytic/imstkAnalyticalGeometry.h @@ -61,12 +61,12 @@ protected: void applyTranslation(const Vec3d t) override; void applyRotation(const Mat3d r) override; - virtual void updatePostTransformData() override; + virtual void updatePostTransformData() const override; Vec3d m_position = WORLD_ORIGIN; ///> position - Vec3d m_positionPostTransform = WORLD_ORIGIN; ///> position once transform applied + mutable Vec3d m_positionPostTransform = WORLD_ORIGIN; ///> position once transform applied Vec3d m_orientationAxis = UP_VECTOR; ///> orientation - Vec3d m_orientationAxisPostTransform = UP_VECTOR; ///> orientation once transform applied + mutable Vec3d m_orientationAxisPostTransform = UP_VECTOR; ///> orientation once transform applied }; } //imstk diff --git a/Source/Geometry/Analytic/imstkCapsule.cpp b/Source/Geometry/Analytic/imstkCapsule.cpp index a2634283db9d3d4de0c7e2feca6a860bda238ab1..bbdc898ce38dad1fb01eb244ce7d6ce5d73e447d 100644 --- a/Source/Geometry/Analytic/imstkCapsule.cpp +++ b/Source/Geometry/Analytic/imstkCapsule.cpp @@ -89,7 +89,7 @@ Capsule::applyScaling(const double s) } void -Capsule::updatePostTransformData() +Capsule::updatePostTransformData() const { if (m_transformApplied) { diff --git a/Source/Geometry/Analytic/imstkCapsule.h b/Source/Geometry/Analytic/imstkCapsule.h index 5c11ffbd9e87ac81df0d16fb9fb44cd74374bcba..7cdb8260cad145eb57e4aacf7686d0e6678104ec 100644 --- a/Source/Geometry/Analytic/imstkCapsule.h +++ b/Source/Geometry/Analytic/imstkCapsule.h @@ -73,11 +73,11 @@ protected: friend class VTKCapsuleRenderDelegate; void applyScaling(const double s) override; - void updatePostTransformData() override; + void updatePostTransformData() const override; double m_radius = 1.0; ///> Radius of the hemispheres at the end of the capsule - double m_radiusPostTransform = 1.0; ///> Radius after transform + mutable double m_radiusPostTransform = 1.0; ///> Radius after transform double m_length = 1.0; ///> Length between the centers of two hemispheres - double m_lengthPostTransform = 1.0; ///> Length after transform + mutable double m_lengthPostTransform = 1.0; ///> Length after transform }; } // imstk diff --git a/Source/Geometry/Analytic/imstkCube.cpp b/Source/Geometry/Analytic/imstkCube.cpp index 63c1cd78e9d488b321745ee730c9332c85f5d738..98c8d9c5d7e790742612d81d5d0563a8a2f7a723 100644 --- a/Source/Geometry/Analytic/imstkCube.cpp +++ b/Source/Geometry/Analytic/imstkCube.cpp @@ -71,7 +71,7 @@ Cube::applyScaling(const double s) } void -Cube::updatePostTransformData() +Cube::updatePostTransformData() const { if (m_transformApplied) { diff --git a/Source/Geometry/Analytic/imstkCube.h b/Source/Geometry/Analytic/imstkCube.h index e36a6ca2f40d5dba662cf2cabe80235824d97625..52c89940f03ecd9a3a0a5a230fa2478780d0c249 100644 --- a/Source/Geometry/Analytic/imstkCube.h +++ b/Source/Geometry/Analytic/imstkCube.h @@ -60,9 +60,9 @@ protected: friend class VTKCubeRenderDelegate; void applyScaling(const double s) override; - void updatePostTransformData() override; + void updatePostTransformData() const override; double m_width = 1.0; ///> Width of the cube - double m_widthPostTransform = 1.0; ///> Width of the cube once transform applied + mutable double m_widthPostTransform = 1.0; ///> Width of the cube once transform applied }; } diff --git a/Source/Geometry/Analytic/imstkCylinder.cpp b/Source/Geometry/Analytic/imstkCylinder.cpp index 38a1e253c11898450a981f7a6d13b30606d6b81c..ee0fa6295f6a1dc64c45d3aaf28d6b8325eb04b9 100644 --- a/Source/Geometry/Analytic/imstkCylinder.cpp +++ b/Source/Geometry/Analytic/imstkCylinder.cpp @@ -101,7 +101,7 @@ Cylinder::applyScaling(const double s) } void -Cylinder::updatePostTransformData() +Cylinder::updatePostTransformData() const { if (m_transformApplied) { diff --git a/Source/Geometry/Analytic/imstkCylinder.h b/Source/Geometry/Analytic/imstkCylinder.h index 5f7e02cc5206d128a295fba7d5fb5cc713a0753e..63462cfdf34137186602ad3b98c96689a9bacd41 100644 --- a/Source/Geometry/Analytic/imstkCylinder.h +++ b/Source/Geometry/Analytic/imstkCylinder.h @@ -73,11 +73,11 @@ protected: friend class VTKCylinderRenderDelegate; void applyScaling(const double s) override; - void updatePostTransformData() override; + void updatePostTransformData() const override; double m_radius = 1.; ///> Radius of the cylinder double m_length = 1.; ///> Length of the cylinder - double m_radiusPostTransform = 1.; ///> Radius of the cylinder oncee transform applied - double m_lengthPostTransform = 1.; ///> Length of the cylinder onc transform applied + mutable double m_radiusPostTransform = 1.; ///> Radius of the cylinder oncee transform applied + mutable double m_lengthPostTransform = 1.; ///> Length of the cylinder onc transform applied }; } // imstk diff --git a/Source/Geometry/Analytic/imstkPlane.cpp b/Source/Geometry/Analytic/imstkPlane.cpp index 1d1822a7567a7e19344460933382090aca494316..d298d07efb80080e55cfa213bc9d2225216e4681 100644 --- a/Source/Geometry/Analytic/imstkPlane.cpp +++ b/Source/Geometry/Analytic/imstkPlane.cpp @@ -89,7 +89,7 @@ Plane::applyScaling(const double s) } void -Plane::updatePostTransformData() +Plane::updatePostTransformData() const { if (m_transformApplied) { diff --git a/Source/Geometry/Analytic/imstkPlane.h b/Source/Geometry/Analytic/imstkPlane.h index dd7c4a6f61ceaf96d1583637b2103c591bee5c84..90a9a3e099a243323c96734b94766d31b5d63bec 100644 --- a/Source/Geometry/Analytic/imstkPlane.h +++ b/Source/Geometry/Analytic/imstkPlane.h @@ -74,9 +74,9 @@ protected: friend class VTKPlaneRenderDelegate; void applyScaling(const double s) override; - void updatePostTransformData() override; + void updatePostTransformData() const override; double m_width = 1.0; ///> Width of the plane - double m_widthPostTransform = 1.0; ///> Width of the plane once transform applied + mutable double m_widthPostTransform = 1.0; ///> Width of the plane once transform applied }; } // imstk diff --git a/Source/Geometry/Analytic/imstkSphere.cpp b/Source/Geometry/Analytic/imstkSphere.cpp index 05d4d9dc7818e399a2c7a678c3705eff94f39749..65af6c65b4aa4811870f89d2197f8ec6f6c2448a 100644 --- a/Source/Geometry/Analytic/imstkSphere.cpp +++ b/Source/Geometry/Analytic/imstkSphere.cpp @@ -88,7 +88,7 @@ Sphere::applyScaling(const double s) } void -Sphere::updatePostTransformData() +Sphere::updatePostTransformData() const { if (m_transformApplied) { diff --git a/Source/Geometry/Analytic/imstkSphere.h b/Source/Geometry/Analytic/imstkSphere.h index 4ae41fd6406aafacd3860c6741df1a4590315d25..1cf1812940779f6d305a7fe9926a946f5ed6e797 100644 --- a/Source/Geometry/Analytic/imstkSphere.h +++ b/Source/Geometry/Analytic/imstkSphere.h @@ -68,9 +68,9 @@ protected: friend class VTKSphereRenderDelegate; void applyScaling(const double s) override; - void updatePostTransformData() override; + void updatePostTransformData() const override; double m_radius = 1.0; ///> Radius of the sphere - double m_radiusPostTransform = 1.0; ///> Radius of the sphere once transform applied + mutable double m_radiusPostTransform = 1.0; ///> Radius of the sphere once transform applied }; } // imstk diff --git a/Source/Geometry/Decal/imstkDecalPool.h b/Source/Geometry/Decal/imstkDecalPool.h index 3f20ae0d01469f034cdaee2d3d38ade2e6cc0061..1a2ceed70095612fbe10a3ba4145c10c14bb3714 100644 --- a/Source/Geometry/Decal/imstkDecalPool.h +++ b/Source/Geometry/Decal/imstkDecalPool.h @@ -61,7 +61,7 @@ protected: void applyTranslation(const Vec3d t) override {} void applyRotation(const Mat3d r) override {} void applyScaling(const double s) override {} - virtual void updatePostTransformData() override {} + virtual void updatePostTransformData() const override {} unsigned int m_maxNumDecals; unsigned int m_numDecals = 0; diff --git a/Source/Geometry/Mesh/imstkImageData.cpp b/Source/Geometry/Mesh/imstkImageData.cpp index 21845bbb106c5cd3a078c78910e37cc70194dbeb..34d17a2a134c0732d5dcd54beaf053bafcdd88de 100644 --- a/Source/Geometry/Mesh/imstkImageData.cpp +++ b/Source/Geometry/Mesh/imstkImageData.cpp @@ -123,7 +123,7 @@ ImageData::applyRotation(const Mat3d r) } void -ImageData::updatePostTransformData() +ImageData::updatePostTransformData() const { if (m_transformApplied || !this->m_data) { diff --git a/Source/Geometry/Mesh/imstkImageData.h b/Source/Geometry/Mesh/imstkImageData.h index 4d5fa73d9e674949ef5259d7d30cd93407baa416..a90b1073ddac36e8b25b246d7abb81a472eaf088 100644 --- a/Source/Geometry/Mesh/imstkImageData.h +++ b/Source/Geometry/Mesh/imstkImageData.h @@ -83,6 +83,6 @@ protected: void applyScaling(const double s) override; - void updatePostTransformData() override; + void updatePostTransformData() const override; }; } // imstk diff --git a/Source/Geometry/Mesh/imstkPointSet.cpp b/Source/Geometry/Mesh/imstkPointSet.cpp index 2f868ccec892ae8acbedda91630685e2c67e724f..b33d9af57cbcb7a54328e4f193d0293aeef13e44 100644 --- a/Source/Geometry/Mesh/imstkPointSet.cpp +++ b/Source/Geometry/Mesh/imstkPointSet.cpp @@ -113,7 +113,7 @@ PointSet::setVertexPositions(const StdVectorOfVec3d& vertices) } const StdVectorOfVec3d& -PointSet::getVertexPositions(DataType type /* = DataType::PostTransform */) +PointSet::getVertexPositions(DataType type /* = DataType::PostTransform */) const { if (type == DataType::PostTransform) { @@ -136,7 +136,7 @@ PointSet::setVertexPosition(const size_t vertNum, const Vec3d& pos) } const Vec3d& -PointSet::getVertexPosition(const size_t vertNum, DataType type) +PointSet::getVertexPosition(const size_t vertNum, DataType type) const { #if defined(DEBUG) || defined(_DEBUG) || !defined(NDEBUG) LOG_IF(FATAL, (vertNum >= getVertexPositions().size())) << "Invalid index"; @@ -275,7 +275,7 @@ PointSet::applyScaling(const double s) } void -PointSet::updatePostTransformData() +PointSet::updatePostTransformData() const { if (m_transformApplied) { diff --git a/Source/Geometry/Mesh/imstkPointSet.h b/Source/Geometry/Mesh/imstkPointSet.h index 4b7b27b4a5e0fe6c2cb8d544c932df85bd358125..f47b909e989811956a17158c2334f4fe0beb1376 100644 --- a/Source/Geometry/Mesh/imstkPointSet.h +++ b/Source/Geometry/Mesh/imstkPointSet.h @@ -91,7 +91,7 @@ public: /// /// \brief Returns the vector of current positions of the mesh vertices /// - const StdVectorOfVec3d& getVertexPositions(DataType type = DataType::PostTransform); + const StdVectorOfVec3d& getVertexPositions(DataType type = DataType::PostTransform) const; /// /// \brief Set the current position of a vertex given its index to certain position (this is not a thread-safe method) @@ -101,7 +101,7 @@ public: /// /// \brief Returns the position of a vertex given its index /// - const Vec3d& getVertexPosition(const size_t vertNum, DataType type = DataType::PostTransform); + const Vec3d& getVertexPosition(const size_t vertNum, DataType type = DataType::PostTransform) const; /// /// \brief Sets the displacements of mesh vertices from an array @@ -177,11 +177,11 @@ protected: void applyTranslation(const Vec3d t) override; void applyRotation(const Mat3d r) override; void applyScaling(const double s) override; - void updatePostTransformData() override; + void updatePostTransformData() const override; StdVectorOfVec3d m_initialVertexPositions; ///> Initial positions of vertices StdVectorOfVec3d m_vertexPositions; ///> Current positions of vertices - StdVectorOfVec3d m_vertexPositionsPostTransform; ///> Positions of vertices after transform + mutable StdVectorOfVec3d m_vertexPositionsPostTransform; ///> Positions of vertices after transform std::map<std::string, StdVectorOfVectorf> m_pointDataMap; ///> vector of data arrays per vertice diff --git a/Source/Geometry/Particles/imstkRenderParticles.h b/Source/Geometry/Particles/imstkRenderParticles.h index 56b8c751f8fe0edca3940a14dbc0364c8f109500..923c41fb5de64de75669fe6b1e798e297e29f7b9 100644 --- a/Source/Geometry/Particles/imstkRenderParticles.h +++ b/Source/Geometry/Particles/imstkRenderParticles.h @@ -127,6 +127,6 @@ protected: void applyTranslation(const Vec3d t) override {} void applyRotation(const Mat3d r) override {} void applyScaling(const double s) override {} - virtual void updatePostTransformData() override {} + virtual void updatePostTransformData() const override {} }; } diff --git a/Source/Geometry/imstkGeometry.h b/Source/Geometry/imstkGeometry.h index 66608d150a4020d4bdaf8e89b811949884811d8b..8a12bb6aa374b4c3fb76e754ed525e300857ec56 100644 --- a/Source/Geometry/imstkGeometry.h +++ b/Source/Geometry/imstkGeometry.h @@ -205,7 +205,7 @@ protected: virtual void applyTranslation(const Vec3d t) = 0; virtual void applyRotation(const Mat3d r) = 0; virtual void applyScaling(const double s) = 0; - virtual void updatePostTransformData() = 0; + virtual void updatePostTransformData() const const = 0; Type m_type; ///> Type of geometry std::string m_name; ///> Unique name for each geometry @@ -213,7 +213,7 @@ protected: bool m_dataModified = false; bool m_transformModified = false; - bool m_transformApplied = true; + mutable bool m_transformApplied = true; RigidTransform3d m_transform = RigidTransform3d::Identity(); ///> Transformation matrix double m_scaling = 1.0;