public override Line Cut(Line L, Point reference) { Point P = IntersectionPoint(L); if (P == null) { return(null); } bool IsDirAtLeft = Director * L.Director.Normal > 0; bool IsRefAtleft = new Metria.Euclidian._2.Vector(P, reference) * L.Director.Normal > 0; if (IsDirAtLeft == IsRefAtleft) { return(new Ray(P, Director)); } if ((Director * L.Director.Normal) * (new Metria.Euclidian._2.Vector(P, reference) * L.Director.Normal) == 0) { return(this); } if (P != Origin) { return(new LineSegment(Origin, P)); } return(null); }
public virtual Line Cut(Line L, Point Reference) { Point P = IntersectionPoint(L); if(P==null) return null; bool IsRefAtLeft = new Metria.Euclidian._2.Vector(P,Reference)*L.Director.Normal>0; //Console.WriteLine("" + new Metria.Euclidian._2.Vector(P, Reference) * L.Director.Normal); bool IsDirAtLeft = Director * L.Director.Normal > 0; if (IsDirAtLeft == IsRefAtLeft) return new Ray(P,Director); if ((new Metria.Euclidian._2.Vector(P, Reference) * L.Director.Normal) * (Director * L.Director.Normal)==0) return new Line(this); return new Ray(P, -1*Director); }
public override Line Cut(Line L, Point reference) { Point P = IntersectionPoint(L); if (P == null) return null; bool IsDirAtLeft = Director * L.Director.Normal > 0; bool IsRefAtleft = new Metria.Euclidian._2.Vector(P, reference) * L.Director.Normal > 0; if (IsDirAtLeft == IsRefAtleft) return new Ray(P, Director); if ((Director * L.Director.Normal) * (new Metria.Euclidian._2.Vector(P, reference) * L.Director.Normal) == 0) return this; if(P!=Origin) return new LineSegment(Origin, P); return null; }
public virtual Line Cut(Line L, Point Reference) { Point P = IntersectionPoint(L); if (P == null) { return(null); } bool IsRefAtLeft = new Metria.Euclidian._2.Vector(P, Reference) * L.Director.Normal > 0; //Console.WriteLine("" + new Metria.Euclidian._2.Vector(P, Reference) * L.Director.Normal); bool IsDirAtLeft = Director * L.Director.Normal > 0; if (IsDirAtLeft == IsRefAtLeft) { return(new Ray(P, Director)); } if ((new Metria.Euclidian._2.Vector(P, Reference) * L.Director.Normal) * (Director * L.Director.Normal) == 0) { return(new Line(this)); } return(new Ray(P, -1 * Director)); }