Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-02-12 02:26:22 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-02-12 02:26:22 +0300
commita6a5ce4f7b5c2bde71715b11052d2ce30a34cb6d (patch)
tree12a40adc00acaa2a2e20795d8bf5dca134feb5ae /source/blender/freestyle/intern/geometry
parented266e868cee7e922f028227ee22492d7e830253 (diff)
More consolidation of the view map creation.
Made an attempt to fix "2D intersection out of range" warnings. These warnings may cause "3D intersection out of range" warnings, which often lead to a crash.
Diffstat (limited to 'source/blender/freestyle/intern/geometry')
-rwxr-xr-xsource/blender/freestyle/intern/geometry/GeomUtils.cpp5
-rwxr-xr-xsource/blender/freestyle/intern/geometry/GeomUtils.h3
-rwxr-xr-xsource/blender/freestyle/intern/geometry/SweepLine.h14
3 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp
index 88aafeed598..2169bce0364 100755
--- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp
@@ -152,7 +152,8 @@ namespace GeomUtils {
const Vec2r& p3,
const Vec2r& p4,
real& t,
- real& u) {
+ real& u,
+ real epsilon) {
real a1, a2, b1, b2, c1, c2; // Coefficients of line eqns
real r1, r2, r3, r4; // 'Sign' values
real denom, num; // Intermediate values
@@ -189,7 +190,7 @@ namespace GeomUtils {
// Line segments intersect: compute intersection point.
denom = a1 * b2 - a2 * b1;
- if (fabs(denom) < M_EPSILON)
+ if (fabs(denom) < epsilon)
return (COLINEAR);
real d1, d2, e1;
diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.h b/source/blender/freestyle/intern/geometry/GeomUtils.h
index 53c94c22f8b..787376108e1 100755
--- a/source/blender/freestyle/intern/geometry/GeomUtils.h
+++ b/source/blender/freestyle/intern/geometry/GeomUtils.h
@@ -94,7 +94,8 @@ namespace GeomUtils {
intersection_test intersect2dSeg2dSegParametric(const Vec2r& p1, const Vec2r& p2, // first segment
const Vec2r& p3, const Vec2r& p4, // second segment
real& t, // I = P1 + t * P1P2)
- real& u); // I = P3 + u * P3P4
+ real& u, // I = P3 + u * P3P4
+ real epsilon = M_EPSILON);
/*! check whether a 2D segment intersect a 2D region or not */
LIB_GEOMETRY_EXPORT
diff --git a/source/blender/freestyle/intern/geometry/SweepLine.h b/source/blender/freestyle/intern/geometry/SweepLine.h
index 386ba3a7388..cf4c86d006d 100755
--- a/source/blender/freestyle/intern/geometry/SweepLine.h
+++ b/source/blender/freestyle/intern/geometry/SweepLine.h
@@ -226,8 +226,9 @@ public:
inline void process(Point& p,
vector<Segment<T,Point>*>& segments,
- binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule
- //binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule = binary_rule<Segment<T,Point>,Segment<T,Point> >()
+ binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule,
+ //binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule = binary_rule<Segment<T,Point>,Segment<T,Point> >(),
+ real epsilon = M_EPSILON
)
{
// first we remove the segments that need to be removed and then
@@ -247,13 +248,14 @@ public:
s!=send;
s++)
{
- add((*s), binrule);
+ add((*s), binrule, epsilon);
}
}
inline void add(Segment<T,Point>* S,
- binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule
- //binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule = binary_rule<Segment<T,Point>, Segment<T,Point> >()
+ binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule,
+ //binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule = binary_rule<Segment<T,Point>, Segment<T,Point> >(),
+ real epsilon
)
{
real t,u;
@@ -298,7 +300,7 @@ public:
if(S->CommonVertex(*currentS, CP))
continue; // the two edges have a common vertex->no need to check
- if(GeomUtils::intersect2dSeg2dSegParametric(v0, v1, v2, v3, t, u) == GeomUtils::DO_INTERSECT)
+ if(GeomUtils::intersect2dSeg2dSegParametric(v0, v1, v2, v3, t, u, epsilon) == GeomUtils::DO_INTERSECT)
{
// create the intersection
Intersection<Segment<T,Point> > * inter = new Intersection<Segment<T,Point> >(S,t,currentS,u);