public override bool Equals(Object obj) { MajorArc arc = obj as MajorArc; if (arc == null) { return(false); } // Check equality of MajorArc Major / major points? return(base.Equals(obj)); }
// Checking for structural equality (is it the same segment) excluding the multiplier public override bool StructurallyEquals(object obj) { MajorArc arc = obj as MajorArc; if (arc == null) { return(false); } return(this.theCircle.StructurallyEquals(arc.theCircle) && ((this.endpoint1.StructurallyEquals(arc.endpoint1) && this.endpoint2.StructurallyEquals(arc.endpoint2)) || (this.endpoint1.StructurallyEquals(arc.endpoint2) && this.endpoint2.StructurallyEquals(arc.endpoint1)))); }
public static Arc GetFigureMajorArc(Circle circle, Point pt1, Point pt2) { MajorArc candArc = new MajorArc(circle, pt1, pt2); // Search for exact segment first foreach (MajorArc arc in figureMajorArcs) { if (arc.StructurallyEquals(candArc)) { return(arc); } } return(null); }
public override bool CoordinateCongruent(Figure that) { MajorArc thatArc = that as MajorArc; if (thatArc == null) { return(false); } if (!theCircle.CoordinateCongruent(thatArc.theCircle)) { return(false); } return(Utilities.CompareValues(this.GetMajorArcMeasureDegrees(), thatArc.GetMajorArcMeasureDegrees())); }
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); }
//Demonstrates: ExteriorAngleHalfDifferenceInterceptedArcs : two tangents //Demonstrates: Tangents from point are congruent public Test05(bool onoff, bool complete) : base(onoff, complete) { //Circle Point o = new Point("O", 0, 0); points.Add(o); Circle circleO = new Circle(o, 5.0); circles.Add(circleO); //Intersection point for two tangents Point c = new Point("C", 0, 6.25); points.Add(c); //Points for tangent line ac, intersection at b Point a = new Point("A", -8, 0.25); points.Add(a); Point b = new Point("B", -3, 4); points.Add(b); //Points for tangent line ec, intersection at d Point e = new Point("E", 8, 0.25); points.Add(e); Point d = new Point("D", 3, 4); points.Add(d); //Create point for another arc (Arc(DF)) of equal measure to (1/2)*(MajorArc(BD)-MinorArc(BD)) MinorArc minor = new MinorArc(circleO, b, d); MajorArc major = new MajorArc(circleO, b, d); double measure = (major.GetMajorArcMeasureDegrees() - minor.GetMinorArcMeasureDegrees()) / 2; //Get theta for D and E Circle unit = new Circle(o, 1.0); Point inter1, trash; unit.FindIntersection(new Segment(o, d), out inter1, out trash); if (inter1.X < 0) inter1 = trash; double dThetaDegrees = (System.Math.Acos(inter1.X)) * (180 / System.Math.PI); double fThetaRadians = (dThetaDegrees - measure) * (System.Math.PI / 180); //Get coordinates for E Point unitPnt = new Point("", System.Math.Cos(fThetaRadians), System.Math.Sin(fThetaRadians)); Point f; circleO.FindIntersection(new Segment(o, unitPnt), out f, out trash); if (f.X < 0) f = trash; f = new Point("F", f.X, f.Y); points.Add(f); //Should now be able to form segments for a central angle of equal measure to (1/2)*(Arc(AB)-Arc(CD)) Segment od = new Segment(o, d); segments.Add(od); Segment of = new Segment(o, f); segments.Add(of); List<Point> pnts = new List<Point>(); pnts.Add(a); pnts.Add(b); pnts.Add(c); collinear.Add(new Collinear(pnts)); pnts = new List<Point>(); pnts.Add(c); pnts.Add(d); pnts.Add(e); collinear.Add(new Collinear(pnts)); parser = new GeometryTutorLib.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff); Segment ac = (Segment)parser.Get(new Segment(a, c)); Segment ce = (Segment)parser.Get(new Segment(c, e)); CircleSegmentIntersection cInter = (CircleSegmentIntersection)parser.Get(new CircleSegmentIntersection(b, circleO, ac)); CircleSegmentIntersection cInter2 = (CircleSegmentIntersection)parser.Get(new CircleSegmentIntersection(d, circleO, ce)); given.Add(new Strengthened(cInter, new Tangent(cInter))); given.Add(new Strengthened(cInter2, new Tangent(cInter2))); MinorArc a1 = (MinorArc)parser.Get(new MinorArc(circleO, b, d)); MajorArc a2 = (MajorArc)parser.Get(new MajorArc(circleO, b, d)); MinorArc centralAngleArc = (MinorArc)parser.Get(new MinorArc(circleO, d, f)); given.Add(new GeometricArcEquation(new Multiplication(new NumericValue(2), centralAngleArc), new Subtraction(a2, a1))); goals.Add(new GeometricCongruentAngles((Angle)parser.Get(new Angle(a, c, e)), (Angle)parser.Get(new Angle(d, o, f)))); goals.Add(new GeometricCongruentSegments((Segment)parser.Get(new Segment(b, c)), (Segment)parser.Get(new Segment(c, d)))); }
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 static Arc GetFigureMajorArc(Circle circle, Point pt1, Point pt2) { MajorArc candArc = new MajorArc(circle, pt1, pt2); // Search for exact segment first foreach (MajorArc arc in figureMajorArcs) { if (arc.StructurallyEquals(candArc)) return arc; } return null; }
// A // /) // / ) // / ) // center: O ) // \ ) // \ ) // \) // C // // D // /) // / ) // / ) // center: Q ) // \ ) // \ ) // \) // F // // Congruent(Segment(AC), Segment(DF)) -> Congruent(Arc(A, C), Arc(D, F)) // private static List<EdgeAggregator> InstantiateForwardPartOfTheorem(CongruentSegments cas) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // // Acquire the circles for which the segments are chords. // List<Circle> circles1 = Circle.GetChordCircles(cas.cs1); List<Circle> circles2 = Circle.GetChordCircles(cas.cs2); // // Make all possible combinations of arcs congruent // foreach (Circle circle1 in circles1) { // Create the appropriate type of arcs from the chord and the circle List<Semicircle> c1semi = null; MinorArc c1minor = null; MajorArc c1major = null; if (circle1.DefinesDiameter(cas.cs1)) { c1semi = CreateSemiCircles(circle1, cas.cs1); } else { c1minor = new MinorArc(circle1, cas.cs1.Point1, cas.cs1.Point2); c1major = new MajorArc(circle1, cas.cs1.Point1, cas.cs1.Point2); } foreach (Circle circle2 in circles2) { //The two circles must be the same or congruent if (circle1.radius == circle2.radius) { List<Semicircle> c2semi = null; MinorArc c2minor = null; MajorArc c2major = null; List<GeometricCongruentArcs> congruencies = new List<GeometricCongruentArcs>(); if (circle2.DefinesDiameter(cas.cs2)) { c2semi = CreateSemiCircles(circle2, cas.cs2); congruencies.AddRange(EquateSemiCircles(c1semi, c2semi)); } else { c2minor = new MinorArc(circle2, cas.cs2.Point1, cas.cs2.Point2); c2major = new MajorArc(circle2, cas.cs2.Point1, cas.cs2.Point2); congruencies.Add(new GeometricCongruentArcs(c1minor, c2minor)); congruencies.Add(new GeometricCongruentArcs(c1major, c2major)); } // For hypergraph List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(cas.cs1); antecedent.Add(cas.cs2); antecedent.Add(cas); foreach (GeometricCongruentArcs gcas in congruencies) { newGrounded.Add(new EdgeAggregator(antecedent, gcas, forwardAnnotation)); } } } } return newGrounded; }
// // A \ // \ B // \ / // O \/ X // /\ // / \ // C / D // // Two tangents: // Intersection(X, AD, BC), Tangent(Circle(O), BC), Tangent(Circle(O), AD) -> 2 * Angle(AXC) = MajorArc(AC) - MinorArc(AC) // public static List<EdgeAggregator> InstantiateTwoTangentsTheorem(Tangent tangent1, Tangent tangent2, Intersection inter, GroundedClause original1, GroundedClause original2) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); CircleSegmentIntersection tan1 = tangent1.intersection as CircleSegmentIntersection; CircleSegmentIntersection tan2 = tangent2.intersection as CircleSegmentIntersection; if (tan1.StructurallyEquals(tan2)) return newGrounded; // Do the tangents apply to the same circle? if (!tan1.theCircle.StructurallyEquals(tan2.theCircle)) return newGrounded; Circle circle = tan1.theCircle; // Do these tangents work with this intersection? if (!inter.HasSegment(tan1.segment) || !inter.HasSegment(tan2.segment)) return newGrounded; // Overkill? Do the tangents intersect at the same point as the intersection's intersect point? if (!tan1.segment.FindIntersection(tan2.segment).StructurallyEquals(inter.intersect)) return newGrounded; // // Get the arcs // Arc minorArc = new MinorArc(circle, tan1.intersect, tan2.intersect); Arc majorArc = new MajorArc(circle, tan1.intersect, tan2.intersect); Angle theAngle = new Angle(tan1.intersect, inter.intersect, tan2.intersect); // // Construct the new relationship // NumericValue two = new NumericValue(2); GeometricAngleArcEquation gaaeq = new GeometricAngleArcEquation(new Multiplication(two, theAngle), new Subtraction(majorArc, minorArc)); // For hypergraph List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(original1); antecedent.Add(original2); antecedent.Add(inter); antecedent.Add(majorArc); antecedent.Add(minorArc); newGrounded.Add(new EdgeAggregator(antecedent, gaaeq, annotation)); return newGrounded; }
private void CreateMajorMinorArcs(Circle circle, int p1, int p2) { List<Point> minorArcPoints; List<Point> majorArcPoints; PartitionArcPoints(circle, p1, p2, out minorArcPoints, out majorArcPoints); MinorArc newMinorArc = new MinorArc(circle, circle.pointsOnCircle[p1], circle.pointsOnCircle[p2], minorArcPoints, majorArcPoints); MajorArc newMajorArc = new MajorArc(circle, circle.pointsOnCircle[p1], circle.pointsOnCircle[p2], minorArcPoints, majorArcPoints); Sector newMinorSector = new Sector(newMinorArc); Sector newMajorSector = new Sector(newMajorArc); if (!GeometryTutorLib.Utilities.HasStructurally<MinorArc>(minorArcs, newMinorArc)) { minorArcs.Add(newMinorArc); minorSectors.Add(newMinorSector); majorSectors.Add(newMajorSector); angles.Add(new Angle(circle.pointsOnCircle[p1], circle.center, circle.pointsOnCircle[p2])); } if (!GeometryTutorLib.Utilities.HasStructurally<MajorArc>(majorArcs, newMajorArc)) { majorArcs.Add(newMajorArc); majorSectors.Add(newMajorSector); } circle.AddMinorArc(newMinorArc); circle.AddMajorArc(newMajorArc); circle.AddMinorSector(newMinorSector); circle.AddMajorSector(newMajorSector); // Generate ArcInMiddle clauses for minor arc and major arc for (int imIndex = 0; imIndex < newMinorArc.arcMinorPoints.Count; imIndex++) { GeometryTutorLib.Utilities.AddStructurallyUnique<ArcInMiddle>(arcInMiddle, new ArcInMiddle(newMinorArc.arcMinorPoints[imIndex], newMinorArc)); } for (int imIndex = 0; imIndex < newMajorArc.arcMajorPoints.Count; imIndex++) { GeometryTutorLib.Utilities.AddStructurallyUnique<ArcInMiddle>(arcInMiddle, new ArcInMiddle(newMajorArc.arcMajorPoints[imIndex], newMajorArc)); } }
public void AddMajorArc(MajorArc mArc) { majorArcs.Add(mArc); }