|
From: Rodrigo H. <kw...@us...> - 2005-05-10 01:29:31
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23294/libsolid Modified Files: Object.cpp Log Message: More on Walk sample Index: Object.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Object.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Object.cpp 21 Apr 2005 18:29:23 -0000 1.3 --- Object.cpp 10 May 2005 01:29:22 -0000 1.4 *************** *** 147,175 **** bool prev_closest_points(const Object& a, const Object& b, ! Vector& v, Point& pa, Point& pb) { ShapePtr sa, sb; ! if (a.shapePtr->getType() == COMPLEX) { ! if (b.shapePtr->getType() == COMPLEX) { ! if (!find_prim((const Complex&)*a.shapePtr, (const Complex&)*b.shapePtr, ! a.curr, b.curr, v, sa, sb)) return false; ! ((Complex *)a.shapePtr)->swapBase(); ! if (b.shapePtr != a.shapePtr) ((Complex *)b.shapePtr)->swapBase(); ! closest_points((const Convex&)*sa, (const Convex&)*sb, a.prev, b.prev, pa, pb); ! ((Complex *)a.shapePtr)->swapBase(); ! if (b.shapePtr != a.shapePtr) ((Complex *)b.shapePtr)->swapBase(); ! } ! else { ! if (!find_prim((const Complex&)*a.shapePtr, (const Convex&)*b.shapePtr, ! a.curr, b.curr, v, sa)) return false; ! ((Complex *)a.shapePtr)->swapBase(); ! closest_points((const Convex&)*sa, (const Convex&)*b.shapePtr, a.prev, b.prev, pa, pb); ! ((Complex *)a.shapePtr)->swapBase(); } ! } ! else { ! if (!intersect(a, b, v)) return false; ! closest_points((const Convex&)*a.shapePtr, (const Convex&)*b.shapePtr, a.prev, b.prev, pa, pb); ! } ! return true; } --- 147,203 ---- bool prev_closest_points(const Object& a, const Object& b, ! Vector& v, Point& pa, Point& pb) ! { ShapePtr sa, sb; ! if (a.shapePtr->getType() == COMPLEX) ! { ! if (b.shapePtr->getType() == COMPLEX) ! { ! // If both shapes are complex ! if (!find_prim((const Complex&)*a.shapePtr, ! (const Complex&)*b.shapePtr, ! a.curr, ! b.curr, ! v, ! sa, ! sb)) return false; ! ((Complex *)a.shapePtr)->swapBase(); ! if (b.shapePtr != a.shapePtr) ! ((Complex *)b.shapePtr)->swapBase(); ! closest_points((const Convex&)*sa, ! (const Convex&)*sb, ! a.prev, ! b.prev, ! pa, ! pb); ! ((Complex *)a.shapePtr)->swapBase(); ! if (b.shapePtr != a.shapePtr) ! ((Complex *)b.shapePtr)->swapBase(); ! } ! else ! { ! // If one (a) Shape is Complex ! if (!find_prim((const Complex&)*a.shapePtr, ! (const Convex&)*b.shapePtr, ! a.curr, b.curr, v, sa)) ! return false; ! ((Complex *)a.shapePtr)->swapBase(); ! closest_points((const Convex&)*sa, ! (const Convex&)*b.shapePtr, ! a.prev, ! b.prev, ! pa, ! pb); ! ((Complex *)a.shapePtr)->swapBase(); ! } } ! else ! { ! // if both are simplex ! if (!intersect(a, b, v)) return false; ! closest_points((const Convex&)*a.shapePtr, ! (const Convex&)*b.shapePtr, ! a.prev, b.prev, pa, pb); ! } return true; } |