[Igarden-commit] Garden/source/LayoutDB ArcPath.cpp, 1.19.2.9, 1.19.2.10 Path.h, 1.38.2.5, 1.38.2.6
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2008-05-10 13:26:17
|
Update of /cvsroot/igarden/Garden/source/LayoutDB In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv17635/source/LayoutDB Modified Files: Tag: Release_branch_v1 ArcPath.cpp Path.h PathElement.cpp Path.cpp Log Message: Make it easier to click on arc paths Index: Path.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/LayoutDB/Path.cpp,v retrieving revision 1.67.2.10 retrieving revision 1.67.2.11 diff -C2 -d -r1.67.2.10 -r1.67.2.11 *** Path.cpp 19 Apr 2008 11:21:25 -0000 1.67.2.10 --- Path.cpp 10 May 2008 13:26:21 -0000 1.67.2.11 *************** *** 1311,1316 **** bool Path::PointOnLineSegment( planPoint_t line1, planPoint_t line2, planPoint_t point, planScale_t scale ) { - double len, U, dx, dy, distance; - planPoint_t intersect; UInt32 width; --- 1311,1314 ---- *************** *** 1322,1326 **** --- 1320,1332 ---- else width = (UInt32)scale*3; + + return PointNearLineSegment(line1, line2, point, width); + } + bool Path::PointNearLineSegment( planPoint_t line1, planPoint_t line2, planPoint_t point, planLength_t near ) + { + planPoint_t intersect; + double len, U, dx, dy, distance; + dx = line2.xOffset - line1.xOffset; dy = line2.yOffset - line1.yOffset; *************** *** 1349,1353 **** } ! return (distance < width); } --- 1355,1359 ---- } ! return (distance < near); } Index: PathElement.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/LayoutDB/PathElement.cpp,v retrieving revision 1.40.2.5 retrieving revision 1.40.2.6 diff -C2 -d -r1.40.2.5 -r1.40.2.6 *** PathElement.cpp 17 Apr 2008 10:51:06 -0000 1.40.2.5 --- PathElement.cpp 10 May 2008 13:26:20 -0000 1.40.2.6 *************** *** 297,300 **** --- 297,301 ---- { PRECONDITION(_path != NULL); + // Scale is only used for determining how much slop to allow, so IsPointWithinPath() doesn't need it. if(_path->IsPointOnPath(point, view->GetScale())) return true; Index: ArcPath.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/LayoutDB/ArcPath.cpp,v retrieving revision 1.19.2.9 retrieving revision 1.19.2.10 diff -C2 -d -r1.19.2.9 -r1.19.2.10 *** ArcPath.cpp 26 Mar 2008 22:23:11 -0000 1.19.2.9 --- ArcPath.cpp 10 May 2008 13:26:20 -0000 1.19.2.10 *************** *** 454,469 **** bool ArcPath::IsPointWithinPath( planPoint_t point ) { ! planLength_t dx, dy; planPoint_t center; if(_isCircle) { ! center = GetCenter(); ! dx = point.xOffset - center.xOffset; ! dy = point.yOffset - center.yOffset; ! return((_radius*_radius) > ((dx*dx)+(dy*dy))); } - else - return false; } --- 454,481 ---- bool ArcPath::IsPointWithinPath( planPoint_t point ) { ! planLength_t dx, dy, allowance; planPoint_t center; + bool result; + long i, count; + + center = GetCenter(); + dx = point.xOffset - center.xOffset; + dy = point.yOffset - center.yOffset; if(_isCircle) + return ((_radius*_radius) > ((dx*dx)+(dy*dy))); + else { ! dx = _pathPoints[1].xOffset - _pathPoints[0].xOffset; ! dy = _pathPoints[1].yOffset - _pathPoints[0].yOffset; ! allowance = sqrt((dx*dx)+(dy*dy)); ! ! count = _pathPoints.Length(); ! for(i = 0, result = false; i < count && !result; i++) ! { ! result = Path::PointNearLineSegment(center, _pathPoints[i], point, allowance); ! } ! return result; } } Index: Path.h =================================================================== RCS file: /cvsroot/igarden/Garden/source/LayoutDB/Path.h,v retrieving revision 1.38.2.5 retrieving revision 1.38.2.6 diff -C2 -d -r1.38.2.5 -r1.38.2.6 *** Path.h 26 Mar 2008 22:18:45 -0000 1.38.2.5 --- Path.h 10 May 2008 13:26:20 -0000 1.38.2.6 *************** *** 168,171 **** --- 168,172 ---- bool PointOnLineSegment(UInt32 indexA, UInt32 indexB, planPoint_t testPoint, planScale_t scale); bool PointOnLineSegment( planPoint_t a, planPoint_t b, planPoint_t testPoint, planScale_t scale ); + bool PointNearLineSegment( planPoint_t line1, planPoint_t line2, planPoint_t point, planLength_t distance ); bool IsPointWithinPolygon( planPoint_t point ); planLength_t MaterialSpacing(); |