Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F735
0001-changed-range-of-value-t-which-is-used-to-determine-.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
saruji
Oct 7 2011, 9:10 AM
2011-10-07 09:10:26 (UTC+2)
Size
2 KB
Referenced Files
None
Subscribers
None
0001-changed-range-of-value-t-which-is-used-to-determine-.patch
View Options
From 6ca0d8f9e877c42e1a64c83101cfe58fe4847bcc Mon Sep 17 00:00:00 2001
From: Danial Saruji <d.saruji@mint-medical.de>
Date: Fri, 7 Oct 2011 09:07:57 +0200
Subject: [PATCH] changed range of value t (which is used to determine whether the
line segment intersects with the plane)
---
.../mitkClippedSurfaceBoundsCalculator.cpp | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/Core/Code/Algorithms/mitkClippedSurfaceBoundsCalculator.cpp b/Core/Code/Algorithms/mitkClippedSurfaceBoundsCalculator.cpp
index f4c309a..445bb31 100644
--- a/Core/Code/Algorithms/mitkClippedSurfaceBoundsCalculator.cpp
+++ b/Core/Code/Algorithms/mitkClippedSurfaceBoundsCalculator.cpp
@@ -1,7 +1,7 @@
#include "mitkClippedSurfaceBoundsCalculator.h"
#include "mitkLine.h"
-#define ROUND_P(x) ((int)((x)+0.5))
+#define ROUND_P(x) ((x)>=0?(int)((x)+0.5):(int)((x)-0.5))
mitk::ClippedSurfaceBoundsCalculator::ClippedSurfaceBoundsCalculator(
const mitk::PlaneGeometry* geometry,
@@ -231,26 +231,25 @@ void mitk::ClippedSurfaceBoundsCalculator::CalculateIntersectionPoints(const mit
// Get intersection point of line and plane geometry
double t = -1.0;
- bool isIntersectionPointOnLine;
- Vector3D lineVector = line.GetPoint1() - line.GetPoint2();
- if(lineVector[0] == 0 && lineVector[1] == 0 && lineVector[2] == 0
- && geometry->IsOnPlane(line.GetPoint1()))
+ bool doesLineIntersectWithPlane(false);
+
+ if(line.GetDirection().GetNorm() < mitk::eps && geometry->Distance(line.GetPoint1()) < mitk::sqrteps)
{
t = 1.0;
- isIntersectionPointOnLine = true;
+ doesLineIntersectWithPlane = true;
intersectionWorldPoint = line.GetPoint1();
}
else
{
geometry->IntersectionPoint(line, intersectionWorldPoint);
- isIntersectionPointOnLine = geometry->IntersectionPointParam(line, t);
+ doesLineIntersectWithPlane = geometry->IntersectionPointParam(line, t);
}
mitk::Point3D intersectionIndexPoint;
//Get index point
m_Image->GetGeometry()->WorldToIndex(intersectionWorldPoint, intersectionIndexPoint);
- if(0.0 <= t && t <= 1.0 && isIntersectionPointOnLine)
+ if ( doesLineIntersectWithPlane && -mitk::sqrteps <= t && t <= 1.0 + mitk::sqrteps )
{
for(int dim = 0; dim < 3; dim++)
{
--
1.7.0.4
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
707
Default Alt Text
0001-changed-range-of-value-t-which-is-used-to-determine-.patch (2 KB)
Attached To
Mode
T9607: Enhance ClippedSurfaceBoundsCalculator to determine intersection points of two Geometry3D
Attached
Detach File
Event Timeline
saruji
added a comment.
Oct 7 2011, 9:10 AM
2011-10-07 09:10:26 (UTC+2)
Comment Actions
changed range of t and distance smaller than sqrteps
Log In to Comment