// // Orthogonal // // // Orthogonal arcs intersect at 90^0: radii connecting to intersection point are perpendicular. // public bool AreOrthognal(Arc thatArc) { if (!this.theCircle.AreOrthognal(thatArc.theCircle)) { return(false); } // Find the intersection points Point inter1; Point inter2; this.theCircle.FindIntersection(thatArc.theCircle, out inter1, out inter2); // Is the intersection between the endpoints of both arcs? Check both. if (Arc.BetweenMinor(inter1, this) && Arc.BetweenMinor(inter1, thatArc)) { return(true); } if (Arc.BetweenMinor(inter2, this) && Arc.BetweenMinor(inter2, thatArc)) { return(true); } return(false); }
public override void FindIntersection(Arc that, out Point inter1, out Point inter2) { // Find the points of intersection this.theCircle.FindIntersection(that.theCircle, out inter1, out inter2); // The points must be on this minor arc. if (this is MinorArc) { if (!Arc.BetweenMinor(inter1, this)) { inter1 = null; } if (!Arc.BetweenMinor(inter2, this)) { inter2 = null; } } else { if (!Arc.BetweenMajor(inter1, this)) { inter1 = null; } if (!Arc.BetweenMajor(inter2, this)) { inter2 = null; } } // The points must be on thatArc if (that is MinorArc) { if (!Arc.BetweenMinor(inter1, that)) { inter1 = null; } if (!Arc.BetweenMinor(inter2, that)) { inter2 = null; } } else { if (!Arc.BetweenMajor(inter1, that)) { inter1 = null; } if (!Arc.BetweenMajor(inter2, that)) { inter2 = null; } } if (inter1 == null && inter2 != null) { inter1 = inter2; inter2 = null; } }
public override void FindIntersection(Segment that, out Point inter1, out Point inter2) { // Find the points of intersection this.theCircle.FindIntersection(that, out inter1, out inter2); // The points must be on this minor arc. if (this is MinorArc) { if (!Arc.BetweenMinor(inter1, this)) { inter1 = null; } if (!Arc.BetweenMinor(inter2, this)) { inter2 = null; } } else if (this is MajorArc) { if (!Arc.BetweenMajor(inter1, this)) { inter1 = null; } if (!Arc.BetweenMajor(inter2, this)) { inter2 = null; } } else if (this is Semicircle) { if (!(this as Semicircle).PointLiesOn(inter1)) { inter1 = null; } if (!(this as Semicircle).PointLiesOn(inter2)) { inter2 = null; } } if (!that.PointLiesOnAndBetweenEndpoints(inter1)) { inter1 = null; } if (!that.PointLiesOnAndBetweenEndpoints(inter2)) { inter2 = null; } if (inter1 == null && inter2 != null) { inter1 = inter2; inter2 = null; } }
// // Tangent circle have 1 intersection point // public Point AreTangent(Arc thatArc) { Point intersection = this.theCircle.AreTangent(thatArc.theCircle); // Is the intersection between the endpoints of both arcs? Check both. if (Arc.BetweenMinor(intersection, this) && Arc.BetweenMinor(intersection, thatArc)) { return(intersection); } if (Arc.BetweenMinor(intersection, this) && Arc.BetweenMinor(intersection, thatArc)) { return(intersection); } return(null); }
// // Point is on the perimeter? // public override bool PointLiesOn(Point pt) { if (pt == null) { return(false); } // Radii KeyValuePair <Segment, Segment> radii = theArc.GetRadii(); if (radii.Key.PointLiesOnAndBetweenEndpoints(pt) || radii.Value.PointLiesOnAndBetweenEndpoints(pt)) { return(true); } // This point must lie on the circle in question, minimally. if (!theArc.theCircle.PointLiesOn(pt)) { return(false); } // Arc if (theArc is MajorArc) { return(Arc.BetweenMajor(pt, theArc as MajorArc)); } else if (theArc is MinorArc) { return(Arc.BetweenMinor(pt, theArc as MinorArc)); } else if (theArc is Semicircle) { Semicircle semi = theArc as Semicircle; // The point in question must lie on the same side of the diameter as the middle point Segment candSeg = new Segment(pt, semi.middlePoint); Point intersection = semi.diameter.FindIntersection(candSeg); return(!candSeg.PointLiesOnAndBetweenEndpoints(intersection)); } return(false); }
private static Arc GetInscribedInterceptedArc(Circle circle, Angle angle) { Point endpt1, endpt2; Point pt1, pt2; circle.FindIntersection(angle.ray1, out pt1, out pt2); endpt1 = pt1.StructurallyEquals(angle.GetVertex()) ? pt2 : pt1; circle.FindIntersection(angle.ray2, out pt1, out pt2); endpt2 = pt1.StructurallyEquals(angle.GetVertex()) ? pt2 : pt1; // Need to check if the angle is a diameter and create a semicircle Segment chord = new Segment(endpt1, endpt2); if (circle.DefinesDiameter(chord)) { Point opp = circle.Midpoint(endpt1, endpt2, angle.GetVertex()); Semicircle semi = new Semicircle(circle, endpt1, endpt2, circle.OppositePoint(opp), chord); //Find a defined semicircle of the figure that lies on the same side Semicircle sameSideSemi = figureSemicircles.Where(s => semi.SameSideSemicircle(s)).FirstOrDefault(); //If none were found, should we throw an exception or just return the original semi? if (sameSideSemi == null) { return(semi); } else { return(sameSideSemi); } } //Initially assume intercepted arc is the minor arc Arc intercepted = null; intercepted = new MinorArc(circle, endpt1, endpt2); //Verify assumption, create major arc if necessary if (Arc.BetweenMinor(angle.GetVertex(), intercepted)) { intercepted = new MajorArc(circle, endpt1, endpt2); } return(intercepted); }
public bool SameSideSemicircle(Semicircle thatSemi) { // First, the endpoints and the diameter must match if (!(this.diameter.StructurallyEquals(thatSemi.diameter) && base.StructurallyEquals(thatSemi))) { return(false); } // if either of the 2 minor arcs formed by this semicircle's middlepoint contain the middlepoint of thatSemi, // then the two semicircles form the same 'side' of the circle MinorArc m = new MinorArc(this.theCircle, this.endpoint1, this.middlePoint); MinorArc m2 = new MinorArc(this.theCircle, this.middlePoint, this.endpoint2); if (Arc.BetweenMinor(thatSemi.middlePoint, m) || Arc.BetweenMinor(thatSemi.middlePoint, m2)) { return(true); } else { return(false); } }
// Does this arc contain a sub-arc: // A-------B-------C------D // A subarc is: AB, AC, AD, BC, BD, CD public bool HasMinorSubArc(Arc arc) { return(Arc.BetweenMinor(arc.endpoint1, this) && Arc.BetweenMinor(arc.endpoint2, this)); }
public override bool PointLiesOn(Point pt) { return(Arc.BetweenMinor(pt, this)); }
public override bool PointLiesOn(Point pt) { return(Arc.BetweenMinor(pt, new MinorArc(theCircle, endpoint1, middlePoint)) || Arc.BetweenMinor(pt, new MinorArc(theCircle, endpoint2, middlePoint))); }