# HG changeset patch # User Sebastien Jodogne # Date 1745334095 -7200 # Node ID ccafa8ffcc6a064b5e9d19bc77b59e1cc4588bcb # Parent d0d8090ea64f3a002453b52dd11d517aff329c2e added CoordinateSystem3D::Equals() diff -r d0d8090ea64f -r ccafa8ffcc6a OrthancStone/Sources/Toolbox/CoordinateSystem3D.cpp --- a/OrthancStone/Sources/Toolbox/CoordinateSystem3D.cpp Tue Apr 22 16:49:12 2025 +0200 +++ b/OrthancStone/Sources/Toolbox/CoordinateSystem3D.cpp Tue Apr 22 17:01:35 2025 +0200 @@ -486,4 +486,24 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); } } + + + bool CoordinateSystem3D::Equals(const CoordinateSystem3D& other) const + { + if (!IsValid() && !other.IsValid()) + { + return true; + } + else if (IsValid() && other.IsValid()) + { + // The normal is automatically computed by "CheckAndComputeNormal()" that is called in all the constructors + return (LinearAlgebra::IsCloseToZero(boost::numeric::ublas::norm_2(GetOrigin() - other.GetOrigin())) && + LinearAlgebra::IsCloseToZero(boost::numeric::ublas::norm_2(GetAxisX() - other.GetAxisX())) && + LinearAlgebra::IsCloseToZero(boost::numeric::ublas::norm_2(GetAxisY() - other.GetAxisY()))); + } + else + { + return false; + } + } } diff -r d0d8090ea64f -r ccafa8ffcc6a OrthancStone/Sources/Toolbox/CoordinateSystem3D.h --- a/OrthancStone/Sources/Toolbox/CoordinateSystem3D.h Tue Apr 22 16:49:12 2025 +0200 +++ b/OrthancStone/Sources/Toolbox/CoordinateSystem3D.h Tue Apr 22 17:01:35 2025 +0200 @@ -165,5 +165,7 @@ std::string& bottom /* out */, std::string& left /* out */, std::string& right /* out */) const; + + bool Equals(const CoordinateSystem3D& other) const; }; } diff -r d0d8090ea64f -r ccafa8ffcc6a OrthancStone/Sources/Toolbox/DicomStructureSet.cpp --- a/OrthancStone/Sources/Toolbox/DicomStructureSet.cpp Tue Apr 22 16:49:12 2025 +0200 +++ b/OrthancStone/Sources/Toolbox/DicomStructureSet.cpp Tue Apr 22 17:01:35 2025 +0200 @@ -306,7 +306,7 @@ bool isOpposite; // Ignored if (boost::numeric::ublas::norm_2(axisX) > 10.0 * std::numeric_limits::epsilon() && - !GeometryToolbox::IsParallelOrOpposite(axisX, estimatedNormal)) + !GeometryToolbox::IsParallelOrOpposite(isOpposite, axisX, estimatedNormal)) { found = true; break;