Mercurial > hg > orthanc-stone
changeset 1641:df4fd96c5706
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Nov 2020 16:58:27 +0100 |
parents | 52b8b96cb55f |
children | 5cc589bfb385 |
files | OrthancStone/Sources/Scene2D/FloatTextureSceneLayer.cpp OrthancStone/Sources/Toolbox/DicomStructurePolygon2.cpp |
diffstat | 2 files changed, 48 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- 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_); }
--- 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<Point2D, Point2D> >& segments, - const CoordinateSystem3D& plane) const -{ - if (points_.size() < 3) - return; + void DicomStructurePolygon2::ProjectOnParallelPlane( + std::vector< std::pair<Point2D, Point2D> >& 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<Point2D, Point2D>(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<Point2D, Point2D>(p0,p1)); + segments.push_back(std::pair<Point2D, Point2D>(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<Point2D, Point2D>(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