# HG changeset patch # User Sebastien Jodogne # Date 1605023907 -3600 # Node ID df4fd96c5706f30aab61a180f098476f914b71ef # Parent 52b8b96cb55f0ded3f268a9d87181561856b7350 cont diff -r 52b8b96cb55f -r df4fd96c5706 OrthancStone/Sources/Scene2D/FloatTextureSceneLayer.cpp --- a/OrthancStone/Sources/Scene2D/FloatTextureSceneLayer.cpp Tue Nov 10 16:55:22 2020 +0100 +++ b/OrthancStone/Sources/Scene2D/FloatTextureSceneLayer.cpp Tue Nov 10 16:58:27 2020 +0100 @@ -89,8 +89,8 @@ void FloatTextureSceneLayer::GetWindowing(float& targetCenter, float& targetWidth) const { - ::OrthancStone::ComputeWindowing(targetCenter, targetWidth, - windowing_, customCenter_, customWidth_); + ComputeWindowing(targetCenter, targetWidth, + windowing_, customCenter_, customWidth_); } diff -r 52b8b96cb55f -r df4fd96c5706 OrthancStone/Sources/Toolbox/DicomStructurePolygon2.cpp --- a/OrthancStone/Sources/Toolbox/DicomStructurePolygon2.cpp Tue Nov 10 16:55:22 2020 +0100 +++ b/OrthancStone/Sources/Toolbox/DicomStructurePolygon2.cpp Tue Nov 10 16:58:27 2020 +0100 @@ -193,8 +193,8 @@ /* void CoordinateSystem3D::ProjectPoint(double& offsetX, - double& offsetY, - const Vector& point) const + double& offsetY, + const Vector& point) const */ double alpha = (v2 - planeV) / (v2 - v1); @@ -241,64 +241,62 @@ } } -void OrthancStone::DicomStructurePolygon2::ProjectOnParallelPlane( - std::vector< std::pair >& segments, - const CoordinateSystem3D& plane) const -{ - if (points_.size() < 3) - return; + void DicomStructurePolygon2::ProjectOnParallelPlane( + std::vector< std::pair >& segments, + const CoordinateSystem3D& plane) const + { + if (points_.size() < 3) + return; - // the plane is horizontal - ORTHANC_ASSERT(LinearAlgebra::IsNear(plane.GetNormal()[0], 0.0)); - ORTHANC_ASSERT(LinearAlgebra::IsNear(plane.GetNormal()[1], 0.0)); + // the plane is horizontal + ORTHANC_ASSERT(LinearAlgebra::IsNear(plane.GetNormal()[0], 0.0)); + ORTHANC_ASSERT(LinearAlgebra::IsNear(plane.GetNormal()[1], 0.0)); + + segments.clear(); + segments.reserve(points_.size()); + // since the returned values need to be expressed in the supplied coordinate + // system, we need to subtract origin_ from the returned points + + double planeOriginX = plane.GetOrigin()[0]; + double planeOriginY = plane.GetOrigin()[1]; - segments.clear(); - segments.reserve(points_.size()); - // since the returned values need to be expressed in the supplied coordinate - // system, we need to subtract origin_ from the returned points + // precondition: points_.size() >= 3 + for (size_t j = 0; j < points_.size()-1; ++j) + { + // segment between point j and j+1 - double planeOriginX = plane.GetOrigin()[0]; - double planeOriginY = plane.GetOrigin()[1]; + const Point3D& point0 = GetPoint(j); + // subtract plane origin x and y + Point2D p0(point0[0] - planeOriginX, point0[1] - planeOriginY); + + const Point3D& point1 = GetPoint(j+1); + // subtract plane origin x and y + Point2D p1(point1[0] - planeOriginX, point1[1] - planeOriginY); - // precondition: points_.size() >= 3 - for (size_t j = 0; j < points_.size()-1; ++j) - { - // segment between point j and j+1 + segments.push_back(std::pair(p0,p1)); + } + - const Point3D& point0 = GetPoint(j); + // final segment + + const Point3D& point0 = GetPoint(points_.size() - 1); // subtract plane origin x and y Point2D p0(point0[0] - planeOriginX, point0[1] - planeOriginY); - - const Point3D& point1 = GetPoint(j+1); + + const Point3D& point1 = GetPoint(0); // subtract plane origin x and y Point2D p1(point1[0] - planeOriginX, point1[1] - planeOriginY); - segments.push_back(std::pair(p0,p1)); + segments.push_back(std::pair(p0, p1)); } - - // final segment - - const Point3D& point0 = GetPoint(points_.size() - 1); - // subtract plane origin x and y - Point2D p0(point0[0] - planeOriginX, point0[1] - planeOriginY); - - const Point3D& point1 = GetPoint(0); - // subtract plane origin x and y - Point2D p1(point1[0] - planeOriginX, point1[1] - planeOriginY); - - segments.push_back(std::pair(p0, p1)); -} - -double OrthancStone::DicomStructurePolygon2::GetZ() const -{ - ORTHANC_ASSERT(LinearAlgebra::IsNear(normal_[0], 0.0)); - ORTHANC_ASSERT(LinearAlgebra::IsNear(normal_[1], 0.0)); - ORTHANC_ASSERT(LinearAlgebra::IsNear(minZ_, maxZ_)); - return minZ_; -} - - + double DicomStructurePolygon2::GetZ() const + { + ORTHANC_ASSERT(LinearAlgebra::IsNear(normal_[0], 0.0)); + ORTHANC_ASSERT(LinearAlgebra::IsNear(normal_[1], 0.0)); + ORTHANC_ASSERT(LinearAlgebra::IsNear(minZ_, maxZ_)); + return minZ_; + } } #endif