/// <summary> /// Teste si le segment courant contient la forme donnée /// </summary> /// <param name="shape">Forme testée</param> /// <returns>Vrai si le segment contient la forme donnée</returns> public override bool Contains(IShape shape) { bool output = false; if (shape is RealPoint) { output = SegmentWithRealPoint.Contains(this, shape as RealPoint); } else if (shape is Segment) { output = SegmentWithSegment.Contains(this, shape as Segment); } else if (shape is Polygon) { output = SegmentWithPolygon.Contains(this, shape as Polygon); } else if (shape is Circle) { output = SegmentWithCircle.Contains(this, shape as Circle); } else if (shape is Line) { output = SegmentWithLine.Contains(this, shape as Line); } return(output); }
public override double Distance(IShape shape) { double output = 0; if (shape is RealPoint) { output = SegmentWithRealPoint.Distance(this, shape as RealPoint); } else if (shape is Segment) { output = SegmentWithSegment.Distance(this, shape as Segment); } else if (shape is Polygon) { output = SegmentWithPolygon.Distance(this, shape as Polygon); } else if (shape is Circle) { output = SegmentWithCircle.Distance(this, shape as Circle); } else if (shape is Line) { output = SegmentWithLine.Distance(this, shape as Line); } return(output); }
/// <summary> /// Retourne la liste des points de croisement avec la forme donnée /// </summary> /// <param name="shape">Forme à tester</param> /// <returns>Liste des points de croisement</returns> public override List <RealPoint> GetCrossingPoints(IShape shape) { List <RealPoint> output = new List <RealPoint>(); if (shape is RealPoint) { output = SegmentWithRealPoint.GetCrossingPoints(this, shape as RealPoint); } else if (shape is Segment) { output = SegmentWithSegment.GetCrossingPoints(this, shape as Segment); } else if (shape is Polygon) { output = SegmentWithPolygon.GetCrossingPoints(this, shape as Polygon); } else if (shape is Circle) { output = SegmentWithCircle.GetCrossingPoints(this, shape as Circle); } else if (shape is Line) { output = SegmentWithLine.GetCrossingPoints(this, shape as Line); } return(output); }