summaryrefslogtreecommitdiffstats
path: root/src/line-geometry.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2007-08-29 13:43:29 +0000
committercilix42 <cilix42@users.sourceforge.net>2007-08-29 13:43:29 +0000
commit55646dba8a87d1a45507794a828ba5dbd90806d0 (patch)
tree075cf578eb061f5a2e970ed56904321a95720777 /src/line-geometry.cpp
parentDNR bpp stuff so much (diff)
downloadinkscape-55646dba8a87d1a45507794a828ba5dbd90806d0.tar.gz
inkscape-55646dba8a87d1a45507794a828ba5dbd90806d0.zip
Constrained center-dragging for 3D boxes (with Ctrl)
(bzr r3608)
Diffstat (limited to 'src/line-geometry.cpp')
-rw-r--r--src/line-geometry.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp
index 5d8eca8a1..7b6ba0449 100644
--- a/src/line-geometry.cpp
+++ b/src/line-geometry.cpp
@@ -192,9 +192,8 @@ double cross_ratio (NR::Point const &A, NR::Point const &B, NR::Point const &C,
double lambda_D = line.lambda (D);
if (fabs (lambda_D - lambda_A) < epsilon || fabs (lambda_C - lambda_B) < epsilon) {
- // FIXME: What should we return if the cross ratio can't be computed?
- return 0;
- //return NR_HUGE;
+ // We return NR_HUGE so that we can catch this case in the calling functions
+ return NR_HUGE;
}
return (((lambda_C - lambda_A) / (lambda_D - lambda_A)) * ((lambda_D - lambda_B) / (lambda_C - lambda_B)));
}
@@ -204,15 +203,18 @@ double cross_ratio (VanishingPoint const &V, NR::Point const &B, NR::Point const
if (V.is_finite()) {
return cross_ratio (V.get_pos(), B, C, D);
} else {
+ if (B == D) {
+ // catch this case so that the line BD below is non-degenerate
+ return 0;
+ }
Line line (B, D);
double lambda_B = line.lambda (B);
double lambda_C = line.lambda (C);
double lambda_D = line.lambda (D);
if (fabs (lambda_C - lambda_B) < epsilon) {
- // FIXME: What should we return if the cross ratio can't be computed?
- return 0;
- //return NR_HUGE;
+ // We return NR_HUGE so that we can catch this case in the calling functions
+ return NR_HUGE;
}
return (lambda_D - lambda_B) / (lambda_C - lambda_B);
}