public bool AngleIsInscribed(Angle angle) { if (!this.theCircle.IsInscribed(angle)) { return(false); } // Verify that angle points match diameter endpoints Point endpt1, endpt2; endpt1 = angle.ray1.Point1.StructurallyEquals(angle.GetVertex()) ? angle.ray1.Point2 : angle.ray1.Point1; endpt2 = angle.ray2.Point1.StructurallyEquals(angle.GetVertex()) ? angle.ray2.Point2 : angle.ray2.Point1; if (!this.diameter.HasPoint(endpt1) || !this.diameter.HasPoint(endpt2)) { return(false); } // Verify that the vertex is within the semicircle if (!this.arcMajorPoints.Contains(angle.GetVertex())) { return(false); } return(true); }
// // If a common segment exists (a transversal that cuts across both intersections), return that common segment // public bool InducesNonStraightAngle(Angle thatAngle) { // The given vertex must match the intersection point of the two lines intersecting if (!intersect.Equals(thatAngle.GetVertex())) { return(false); } // / // / // /_______ // if (this.StandsOnEndpoint()) { return(thatAngle.Equates(new Angle(lhs.OtherPoint(intersect), intersect, rhs.OtherPoint(intersect)))); } // / // / // _______/_______ // else if (this.StandsOn()) { Point off = this.CreatesTShape(); Segment baseSegment = lhs.PointLiesOnAndExactlyBetweenEndpoints(intersect) ? lhs : rhs; if (thatAngle.Equates(new Angle(baseSegment.Point1, intersect, off))) { return(true); } if (thatAngle.Equates(new Angle(baseSegment.Point2, intersect, off))) { return(true); } } // / // _______/_______ // / // / else if (this.Crossing()) { if (thatAngle.Equates(new Angle(lhs.Point1, intersect, rhs.Point1))) { return(true); } if (thatAngle.Equates(new Angle(lhs.Point1, intersect, rhs.Point2))) { return(true); } if (thatAngle.Equates(new Angle(lhs.Point2, intersect, rhs.Point1))) { return(true); } if (thatAngle.Equates(new Angle(lhs.Point2, intersect, rhs.Point2))) { return(true); } } return(false); }
public bool AngleIsInscribed(Angle angle) { if (!this.theCircle.IsInscribed(angle)) return false; // Verify that angle points match diameter endpoints Point endpt1, endpt2; endpt1 = angle.ray1.Point1.StructurallyEquals(angle.GetVertex()) ? angle.ray1.Point2 : angle.ray1.Point1; endpt2 = angle.ray2.Point1.StructurallyEquals(angle.GetVertex()) ? angle.ray2.Point2 : angle.ray2.Point1; if (!this.diameter.HasPoint(endpt1) || !this.diameter.HasPoint(endpt2)) return false; // Verify that the vertex is within the semicircle if (!this.arcMajorPoints.Contains(angle.GetVertex())) return false; return true; }
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); }
private static List<EdgeAggregator> InstantiateAngles(Angle angle1, Angle angle2) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // An angle may have multiple names if (angle1.Equates(angle2)) return newGrounded; if (!angle1.GetVertex().Equals(angle2.GetVertex())) return newGrounded; // Determine the shared segment if we have an adjacent situation Segment shared = angle1.IsAdjacentTo(angle2); if (shared == null) return newGrounded; // // If we combine these two angles, the result is a third angle, which, when measured, // would be less than 180; this is contradictory since we measuare angles greedily and no circular angle is measured as > 180 // if (angle1.measure + angle2.measure > 180) return newGrounded; // Angle(A, B, C), Angle(C, B, D) -> Angle(A, B, C) + Angle(C, B, D) = Angle(A, B, D) Point vertex = angle1.GetVertex(); Point exteriorPt1 = angle2.OtherPoint(shared); Point exteriorPt2 = angle1.OtherPoint(shared); Angle newAngle = new Angle(exteriorPt1, vertex, exteriorPt2); Addition sum = new Addition(angle1, angle2); GeometricAngleEquation geoAngEq = new GeometricAngleEquation(sum, newAngle); geoAngEq.MakeAxiomatic(); // This is an axiomatic equation // For hypergraph construction List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(angle1); antecedent.Add(angle2); newGrounded.Add(new EdgeAggregator(antecedent, geoAngEq, annotation)); return newGrounded; }
// // Is the given angle the same as this angle? that is, the vertex is the same and the rays coincide // (not necessarily with the same endpoints) // Can't just be collinear, must be collinear and on same side of an angle // public bool Equates(Angle thatAngle) { //if (this.Equals(thatAngle)) return true; // Vertices must equate if (!this.GetVertex().Equals(thatAngle.GetVertex())) { return(false); } // Rays must originate at the vertex and emanate outward return((ray1.RayOverlays(thatAngle.ray1) && ray2.RayOverlays(thatAngle.ray2)) || (ray2.RayOverlays(thatAngle.ray1) && ray1.RayOverlays(thatAngle.ray2))); }
private static EdgeAggregator ConstructExteriorRelationship(Triangle tri, Angle extAngle) { // // Acquire the remote angles // Angle remote1 = null; Angle remote2 = null; tri.AcquireRemoteAngles(extAngle.GetVertex(), out remote1, out remote2); // // Construct the new equation // Addition sum = new Addition(remote1, remote2); GeometricAngleEquation eq = new GeometricAngleEquation(extAngle, sum); // // For the hypergraph // List<GroundedClause> antecedent = Utilities.MakeList<GroundedClause>(tri); antecedent.Add(extAngle); return new EdgeAggregator(antecedent, eq, annotation); }
// // Acquires one or two intercepted arcs from an exterior or interior angle vertex. // public static KeyValuePair<Arc, Arc> GetInterceptedArcs(Circle circle, Angle angle) { KeyValuePair<Arc, Arc> nullPair = new KeyValuePair<Arc, Arc>(null, null); // // Get the intersection points of the rays of the angle. // Point interRay11 = null; Point interRay12 = null; circle.FindIntersection(angle.ray1, out interRay11, out interRay12); if (!angle.ray1.PointLiesOnAndBetweenEndpoints(interRay11)) interRay11 = null; if (!angle.ray1.PointLiesOnAndBetweenEndpoints(interRay12)) interRay12 = null; if (interRay11 == null && interRay12 != null) interRay11 = interRay12; // non-intersection if (interRay11 == null && interRay12 == null) return nullPair; Point interRay21 = null; Point interRay22 = null; circle.FindIntersection(angle.ray2, out interRay21, out interRay22); if (!angle.ray2.PointLiesOnAndBetweenEndpoints(interRay21)) interRay21 = null; if (!angle.ray2.PointLiesOnAndBetweenEndpoints(interRay22)) interRay22 = null; if (interRay21 == null && interRay22 != null) interRay21 = interRay22; // non-intersection if (interRay21 == null && interRay22 == null) return nullPair; // // Split the rays into cases based on if they are secants or not. // bool isSecRay1 = angle.ray1.IsSecant(circle); bool isSecRay2 = angle.ray2.IsSecant(circle); // // One Arc: No secants // if (!isSecRay1 && !isSecRay2) { // This means the endpoints of the ray were on the circle directly for each. return new KeyValuePair<Arc,Arc>(Arc.GetFigureMinorArc(circle, interRay11, interRay21), null); } // // One Arc; with one secant and one not. // else if (!isSecRay1 || !isSecRay2) { Segment secant = null; Segment nonSecant = null; Point endPtNonSecant = null; if (isSecRay1) { secant = angle.ray1; nonSecant = angle.ray2; endPtNonSecant = interRay21; } else { secant = angle.ray2; nonSecant = angle.ray1; endPtNonSecant = interRay11; } Segment chordOfSecant = circle.ContainsChord(secant); Point endptSecant = Segment.Between(chordOfSecant.Point1, angle.GetVertex(), chordOfSecant.Point2) ? chordOfSecant.Point1 : chordOfSecant.Point2; return new KeyValuePair<Arc,Arc>(Arc.GetFigureMinorArc(circle, endPtNonSecant, endptSecant), null); } // // Two arcs // else { // // Ensure proper ordering of points // Point closeRay1, farRay1; Point closeRay2, farRay2; if (Segment.Between(interRay11, angle.GetVertex(), interRay12)) { closeRay1 = interRay11; farRay1 = interRay12; } else { closeRay1 = interRay12; farRay1 = interRay11; } if (Segment.Between(interRay21, angle.GetVertex(), interRay22)) { closeRay2 = interRay21; farRay2 = interRay22; } else { closeRay2 = interRay22; farRay2 = interRay21; } return new KeyValuePair<Arc, Arc>(Arc.GetFigureMinorArc(circle, closeRay1, closeRay2), Arc.GetFigureMinorArc(circle, farRay1, farRay2)); } }
// // Acquires one or two intercepted arcs from an exterior or interior angle vertex. // public static KeyValuePair <Arc, Arc> GetInterceptedArcs(Circle circle, Angle angle) { KeyValuePair <Arc, Arc> nullPair = new KeyValuePair <Arc, Arc>(null, null); // // Get the intersection points of the rays of the angle. // Point interRay11 = null; Point interRay12 = null; circle.FindIntersection(angle.ray1, out interRay11, out interRay12); if (!angle.ray1.PointLiesOnAndBetweenEndpoints(interRay11)) { interRay11 = null; } if (!angle.ray1.PointLiesOnAndBetweenEndpoints(interRay12)) { interRay12 = null; } if (interRay11 == null && interRay12 != null) { interRay11 = interRay12; } // non-intersection if (interRay11 == null && interRay12 == null) { return(nullPair); } Point interRay21 = null; Point interRay22 = null; circle.FindIntersection(angle.ray2, out interRay21, out interRay22); if (!angle.ray2.PointLiesOnAndBetweenEndpoints(interRay21)) { interRay21 = null; } if (!angle.ray2.PointLiesOnAndBetweenEndpoints(interRay22)) { interRay22 = null; } if (interRay21 == null && interRay22 != null) { interRay21 = interRay22; } // non-intersection if (interRay21 == null && interRay22 == null) { return(nullPair); } // // Split the rays into cases based on if they are secants or not. // bool isSecRay1 = angle.ray1.IsSecant(circle); bool isSecRay2 = angle.ray2.IsSecant(circle); // // One Arc: No secants // if (!isSecRay1 && !isSecRay2) { // This means the endpoints of the ray were on the circle directly for each. return(new KeyValuePair <Arc, Arc>(Arc.GetFigureMinorArc(circle, interRay11, interRay21), null)); } // // One Arc; with one secant and one not. // else if (!isSecRay1 || !isSecRay2) { Segment secant = null; Segment nonSecant = null; Point endPtNonSecant = null; if (isSecRay1) { secant = angle.ray1; nonSecant = angle.ray2; endPtNonSecant = interRay21; } else { secant = angle.ray2; nonSecant = angle.ray1; endPtNonSecant = interRay11; } Segment chordOfSecant = circle.ContainsChord(secant); Point endptSecant = Segment.Between(chordOfSecant.Point1, angle.GetVertex(), chordOfSecant.Point2) ? chordOfSecant.Point1 : chordOfSecant.Point2; return(new KeyValuePair <Arc, Arc>(Arc.GetFigureMinorArc(circle, endPtNonSecant, endptSecant), null)); } // // Two arcs // else { // // Ensure proper ordering of points // Point closeRay1, farRay1; Point closeRay2, farRay2; if (Segment.Between(interRay11, angle.GetVertex(), interRay12)) { closeRay1 = interRay11; farRay1 = interRay12; } else { closeRay1 = interRay12; farRay1 = interRay11; } if (Segment.Between(interRay21, angle.GetVertex(), interRay22)) { closeRay2 = interRay21; farRay2 = interRay22; } else { closeRay2 = interRay22; farRay2 = interRay21; } return(new KeyValuePair <Arc, Arc>(Arc.GetFigureMinorArc(circle, closeRay1, closeRay2), Arc.GetFigureMinorArc(circle, farRay1, farRay2))); } }
public Point SameVertex(Angle ang) { return(GetVertex().Equals(ang.GetVertex()) ? GetVertex() : null); }
public bool IsIncludedAngle(Segment s1, Segment s2, Angle a) { if (!HasSegment(s1) || !HasSegment(s2) && !HasAngle(a)) return false; // If the shared vertex between the segments is the vertex of this given angle, then // the angle is the included angle as desired return s1.SharedVertex(s2).Equals(a.GetVertex()); }
public Segment GetOppositeSide(Angle angle) { Point vertex = angle.GetVertex(); if (!SegmentA.HasPoint(vertex)) return SegmentA; if (!SegmentB.HasPoint(vertex)) return SegmentB; if (!SegmentC.HasPoint(vertex)) return SegmentC; return null; }
public Point SameVertex(Angle ang) { return GetVertex().Equals(ang.GetVertex()) ? GetVertex() : null; }
// // Is the given angle the same as this angle? that is, the vertex is the same and the rays coincide // (not necessarily with the same endpoints) // Can't just be collinear, must be collinear and on same side of an angle // public bool Equates(Angle thatAngle) { //if (this.Equals(thatAngle)) return true; // Vertices must equate if (!this.GetVertex().Equals(thatAngle.GetVertex())) return false; // Rays must originate at the vertex and emanate outward return (ray1.RayOverlays(thatAngle.ray1) && ray2.RayOverlays(thatAngle.ray2)) || (ray2.RayOverlays(thatAngle.ray1) && ray1.RayOverlays(thatAngle.ray2)); }
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 Segment OtherSide(Angle a) { Point vertex = a.GetVertex(); if (!SegmentA.HasPoint(vertex)) return SegmentA; if (!SegmentB.HasPoint(vertex)) return SegmentB; if (!SegmentC.HasPoint(vertex)) return SegmentC; return null; }
// // If a common segment exists (a transversal that cuts across both intersections), return that common segment // public bool InducesNonStraightAngle(Angle thatAngle) { // The given vertex must match the intersection point of the two lines intersecting if (!intersect.Equals(thatAngle.GetVertex())) return false; // / // / // /_______ // if (this.StandsOnEndpoint()) { return thatAngle.Equates(new Angle(lhs.OtherPoint(intersect), intersect, rhs.OtherPoint(intersect))); } // / // / // _______/_______ // else if (this.StandsOn()) { Point off = this.CreatesTShape(); Segment baseSegment = lhs.PointLiesOnAndExactlyBetweenEndpoints(intersect) ? lhs : rhs; if (thatAngle.Equates(new Angle(baseSegment.Point1, intersect, off))) return true; if (thatAngle.Equates(new Angle(baseSegment.Point2, intersect, off))) return true; } // / // _______/_______ // / // / else if (this.Crossing()) { if (thatAngle.Equates(new Angle(lhs.Point1, intersect, rhs.Point1))) return true; if (thatAngle.Equates(new Angle(lhs.Point1, intersect, rhs.Point2))) return true; if (thatAngle.Equates(new Angle(lhs.Point2, intersect, rhs.Point1))) return true; if (thatAngle.Equates(new Angle(lhs.Point2, intersect, rhs.Point2))) return true; } return false; }
// // Is the given angle directly exterior to this triangle? // // The triangle must share a side with the angle, the non-shared side must extend the adjacent side public bool HasExteriorAngle(Angle extAngle) { // Disallow any angle in this triangle (since it technically satisfies the requirements) if (HasAngle(extAngle)) return false; // Determine which angle in the triangle has the same vertex as the input angle Angle triangleAngle = GetAngleWithVertex(extAngle.GetVertex()); if (triangleAngle == null) return false; // Acquire the ray that is shared between the angle and the triangle Segment sharedSegment = triangleAngle.SharedRay(extAngle); if (sharedSegment == null) return false; // Acquire the other side of the triangle Segment otherTriangleSegment = triangleAngle.OtherRay(sharedSegment); if (otherTriangleSegment == null) return false; // Acquire the ray that is not shared Segment exteriorSegment = extAngle.OtherRay(sharedSegment); if (exteriorSegment == null) return false; // DISALLOW ALLOW // / / // / \ / \ // /TRI\ /TRI\ // /-----\ /-----\ // / \ // / \ // / \ return otherTriangleSegment.IsCollinearWith(exteriorSegment); }
public bool IsCentral(Angle angle) { if (this.center.StructurallyEquals(angle.GetVertex())) { // The rays need to contain radii of the circle. if (this.ContainsRadiusWithin(angle.ray1) && this.ContainsRadiusWithin(angle.ray2)) { return true; } } return false; }
private static List<EdgeAggregator> CheckAndGeneratePerpendicularImplyCongruentAdjacent(Perpendicular perp, Angle angle1, Angle angle2) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); if (!Utilities.CompareValues(angle1.measure + angle2.measure, 90)) return newGrounded; // The perpendicular intersection must occur at the same vertex of both angles (we only need check one). if (!(angle1.GetVertex().Equals(perp.intersect) && angle2.GetVertex().Equals(perp.intersect))) return newGrounded; // Are the angles adjacent? Segment sharedRay = angle1.IsAdjacentTo(angle2); if (sharedRay == null) return newGrounded; // Do the non-shared rays for both angles align with the segments defined by the perpendicular intersection? if (!perp.DefinesBothRays(angle1.OtherRayEquates(sharedRay), angle2.OtherRayEquates(sharedRay))) return newGrounded; // // Now we have perpendicular -> complementary angles scenario // Complementary cas = new Complementary(angle1, angle2); // Construct hyperedge List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(perp); antecedent.Add(angle1); antecedent.Add(angle2); newGrounded.Add(new EdgeAggregator(antecedent, cas, annotation)); return newGrounded; }
public bool IsInscribed(Angle angle) { // If the angle has vertex on the circle if (!this.PointLiesOn(angle.GetVertex())) return false; // Do the angle rays form or contain chords? // GetChord() will check if the segment is a chord, and if it is not, it will check if the segment is a secant containing a chord Segment chord1 = this.GetChord(angle.ray1); Segment chord2 = this.GetChord(angle.ray2); return chord1 != null && chord2 != null; }