diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2007-08-26 17:16:03 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2007-08-26 17:16:03 +0000 |
| commit | cf59f9ff6a8eb98441942ca7d8618dfa31361e93 (patch) | |
| tree | f1cf9056d32f60c1da57f5dc4d03749df851e44d /src/line-geometry.cpp | |
| parent | 2 LPE things: (diff) | |
| download | inkscape-cf59f9ff6a8eb98441942ca7d8618dfa31361e93.tar.gz inkscape-cf59f9ff6a8eb98441942ca7d8618dfa31361e93.zip | |
Rewrite of z-order code for 3D boxes, first stage (hopefully this is finally the right approach)
(bzr r3586)
Diffstat (limited to 'src/line-geometry.cpp')
| -rw-r--r-- | src/line-geometry.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp index f6f411bff..000da8a07 100644 --- a/src/line-geometry.cpp +++ b/src/line-geometry.cpp @@ -100,8 +100,8 @@ std::pair<double, double> coordinates (NR::Point const &v1, NR::Point const &v2, { double det = determinant (v1, v2);; if (fabs (det) < epsilon) { - g_warning ("Vectors do not form a basis.\n"); - return std::make_pair (0.0, 0.0); + // vectors are not linearly independent; we indicate this in the return value(s) + return std::make_pair (HUGE_VAL, HUGE_VAL); } double lambda1 = determinant (w, v2) / det; @@ -113,6 +113,11 @@ std::pair<double, double> coordinates (NR::Point const &v1, NR::Point const &v2, bool lies_in_sector (NR::Point const &v1, NR::Point const &v2, NR::Point const &w) { std::pair<double, double> coords = coordinates (v1, v2, w); + if (coords.first == HUGE_VAL) { + // catch the case that the vectors are not linearly independent + // FIXME: Can we assume that it's safe to return true if the vectors point in different directions? + return (NR::dot (v1, v2) < 0); + } return (coords.first >= 0 and coords.second >= 0); } |
