Skip to content
Snippets Groups Projects
Commit 8e9b1be7 authored by Johannes Junggeburth's avatar Johannes Junggeburth :dog2: Committed by Joseph Boudreau
Browse files

GeoTransform - Return default transform by reference

parent 3d2977af
No related branches found
No related tags found
1 merge request!255GeoTransform - Return default transform by reference
...@@ -24,21 +24,21 @@ class GeoTransform : public GeoGraphNode { ...@@ -24,21 +24,21 @@ class GeoTransform : public GeoGraphNode {
GeoTransform(const GeoTrf::Transform3D& transform); GeoTransform(const GeoTrf::Transform3D& transform);
/// Gets the total transformation. /// Gets the total transformation.
virtual GeoTrf::Transform3D getTransform(const GeoVAlignmentStore* store=nullptr) const; virtual GeoTrf::Transform3D getTransform(const GeoVAlignmentStore* store=nullptr) const;
/// Gets the default transformation (no alignment correction) /// Gets the default transformation (no alignment correction)
GeoTrf::Transform3D getDefTransform(const GeoVAlignmentStore* store=nullptr) const; const GeoTrf::Transform3D& getDefTransform(const GeoVAlignmentStore* store=nullptr) const;
/// Executes a GeoNodeAction. /// Executes a GeoNodeAction.
virtual void exec(GeoNodeAction *action) const override final; virtual void exec(GeoNodeAction *action) const override final;
protected: protected:
virtual ~GeoTransform() = default; virtual ~GeoTransform() = default;
private: private:
// The Euclidean (Rigid Body) transform. // The Euclidean (Rigid Body) transform.
GeoTrf::Transform3D m_transform{GeoTrf::Transform3D::Identity()}; GeoTrf::Transform3D m_transform{GeoTrf::Transform3D::Identity()};
}; };
#endif #endif
...@@ -24,16 +24,16 @@ GeoTrf::Transform3D GeoAlignableTransform::getTransform(const GeoVAlignmentStore ...@@ -24,16 +24,16 @@ GeoTrf::Transform3D GeoAlignableTransform::getTransform(const GeoVAlignmentStore
{ {
if(store) { if(store) {
const GeoTrf::Transform3D* delta = store->getDelta(this); const GeoTrf::Transform3D* delta = store->getDelta(this);
return GeoTransform::getTransform(nullptr) * (!delta ? GeoTrf::Transform3D::Identity() : *delta); return getDefTransform(store) * (!delta ? GeoTrf::Transform3D::Identity() : *delta);
} }
else { else if (m_delta) {
std::scoped_lock<std::mutex> guard(m_deltaMutex); std::scoped_lock<std::mutex> guard(m_deltaMutex);
return GeoTransform::getTransform(nullptr) * (!m_delta ? GeoTrf::Transform3D::Identity() : *m_delta); return getDefTransform(store) * (*m_delta);
} }
return getDefTransform(store);
} }
void GeoAlignableTransform::setDelta(const GeoTrf::Transform3D& delta, GeoVAlignmentStore* store) void GeoAlignableTransform::setDelta(const GeoTrf::Transform3D& delta, GeoVAlignmentStore* store) {
{
if(!store) { if(!store) {
{ {
std::scoped_lock<std::mutex> guard(m_deltaMutex); std::scoped_lock<std::mutex> guard(m_deltaMutex);
......
...@@ -15,7 +15,7 @@ GeoTrf::Transform3D GeoTransform::getTransform(const GeoVAlignmentStore* /*store ...@@ -15,7 +15,7 @@ GeoTrf::Transform3D GeoTransform::getTransform(const GeoVAlignmentStore* /*store
return m_transform; return m_transform;
} }
GeoTrf::Transform3D GeoTransform::getDefTransform(const GeoVAlignmentStore* /*store*/) const { const GeoTrf::Transform3D& GeoTransform::getDefTransform(const GeoVAlignmentStore* /*store*/) const {
return m_transform; return m_transform;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment