예제 #1
0
파일: Line.cs 프로젝트: SOFAgh/CADability
 bool IOctTreeInsertable.HitTest(Projection projection, BoundingRect rect, bool onlyInside)
 {   // kommt dran bei GetObjectsCloseTo
     if (onlyInside)
     {
         return(false);
     }
     else
     {
         ClipRect clr = new ClipRect(ref rect);
         // eine Linie machen, die bestimmt über das rechteck hinaus geht
         GeoPoint2D  sp2d  = projection.ProjectUnscaled(start);
         GeoVector2D dir2d = projection.ProjectUnscaled(dir);
         double      max   = 0.0;
         max = Math.Max(max, sp2d | rect.GetLowerLeft());
         max = Math.Max(max, sp2d | rect.GetLowerRight());
         max = Math.Max(max, sp2d | rect.GetUpperLeft());
         max = Math.Max(max, sp2d | rect.GetUpperRight());
         GeoPoint2D ep2d = sp2d + max * dir2d;
         return(clr.LineHitTest(sp2d, ep2d));
     }
 }