Ejemplo n.º 1
0
        /// <summary>
        /// Figure out which angles we can choose from before the window is shown.
        /// </summary>
        protected override void OnShow()
        {
            List <GroundedClause> givens = new List <GroundedClause>();

            //Populate list with applicable givens
            foreach (GroundedClause gc in currentGivens)
            {
                GeometryTutorLib.ConcreteAST.AngleBisector ab = gc as GeometryTutorLib.ConcreteAST.AngleBisector;
                if (ab != null)
                {
                    givens.Add(ab);
                }
            }

            var bisectors = new List <GeometryTutorLib.ConcreteAST.AngleBisector>();

            //Populate list with possible choices
            foreach (GeometryTutorLib.ConcreteAST.AngleBisector ab in parser.backendParser.implied.angleBisectors)
            {
                if (!StructurallyContains(givens, ab))
                {
                    bisectors.Add(ab);
                }
            }

            options.ItemsSource = null; //Makes sure the box is graphically updated.
            options.ItemsSource = bisectors;
        }
        private static List<EdgeAggregator> InstantiateToTheorem(Rhombus rhombus, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // For hypergraph
            List<GroundedClause> antecedent = Utilities.MakeList<GroundedClause>(original);

            // Instantiate this rhombus diagonals ONLY if the original figure has the diagonals drawn.
            if (rhombus.TopLeftDiagonalIsValid())
            {
                AngleBisector ab1 = new AngleBisector(rhombus.topLeftAngle, rhombus.topLeftBottomRightDiagonal);
                AngleBisector ab2 = new AngleBisector(rhombus.bottomRightAngle, rhombus.topLeftBottomRightDiagonal);
                newGrounded.Add(new EdgeAggregator(antecedent, ab1, annotation));
                newGrounded.Add(new EdgeAggregator(antecedent, ab2, annotation));
            }

            if (rhombus.BottomRightDiagonalIsValid())
            {
                AngleBisector ab1 = new AngleBisector(rhombus.topRightAngle, rhombus.bottomLeftTopRightDiagonal);
                AngleBisector ab2 = new AngleBisector(rhombus.bottomLeftAngle, rhombus.bottomLeftTopRightDiagonal);
                newGrounded.Add(new EdgeAggregator(antecedent, ab1, annotation));
                newGrounded.Add(new EdgeAggregator(antecedent, ab2, annotation));
            }

            return newGrounded;
        }
Ejemplo n.º 3
0
        public override bool Equals(Object obj)
        {
            AngleBisector ab = obj as AngleBisector;

            if (ab == null)
            {
                return(false);
            }
            return(angle.Equals(ab.angle) && bisector.Equals(ab.bisector) && base.Equals(obj));
        }
Ejemplo n.º 4
0
        public override bool StructurallyEquals(Object obj)
        {
            AngleBisector ab = obj as AngleBisector;

            if (ab == null)
            {
                return(false);
            }
            return(angle.StructurallyEquals(ab.angle) && bisector.StructurallyEquals(ab.bisector));
        }
Ejemplo n.º 5
0
        //      V---------------A
        //     / \
        //    /   \
        //   /     \
        //  B       C
        //
        // AngleBisector(Angle(A, V, B), Segment(V, C)) -> Congruent(Angle, A, V, C), Angle(C, V, B))
        //
        private static List<EdgeAggregator> InstantiateBisector(AngleBisector ab)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Create the two adjacent angles
            Point vertex = ab.angle.GetVertex();
            Point interiorPt = ab.angle.IsOnInteriorExplicitly(ab.bisector.Point1) ? ab.bisector.Point1 : ab.bisector.Point2;
            Angle adj1 = new Angle(ab.angle.ray1.OtherPoint(vertex), vertex, interiorPt);
            Angle adj2 = new Angle(ab.angle.ray2.OtherPoint(vertex), vertex, interiorPt);
            GeometricCongruentAngles cas = new GeometricCongruentAngles(adj1, adj2);

            // For hypergraph
            newGrounded.Add(new EdgeAggregator(Utilities.MakeList<GroundedClause>(ab), cas, annotation));

            return newGrounded;
        }
        public static List<GenericInstantiator.EdgeAggregator> GeneratePerpendicularBisector(GroundedClause tri, AngleBisector ab, Intersection inter)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            IsoscelesTriangle isoTri = (tri is Strengthened ? (tri as Strengthened).strengthened : tri) as IsoscelesTriangle;

            if (tri is EquilateralTriangle)
            {

            }

            // Does the Angle Bisector occur at the vertex angle (non-base angles) of the Isosceles triangle?
            try
            {
                if (!ab.angle.GetVertex().Equals(isoTri.GetVertexAngle().GetVertex())) return newGrounded;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.ToString());
            }

            // Is the intersection point between the endpoints of the base of the triangle?
            if (!Segment.Between(inter.intersect, isoTri.baseSegment.Point1, isoTri.baseSegment.Point2)) return newGrounded;

            // Does this intersection define this angle bisector situation? That is, the bisector and base must align with the intersection
            if (!inter.ImpliesRay(ab.bisector)) return newGrounded;
            if (!inter.HasSegment(isoTri.baseSegment)) return newGrounded;

            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(tri);
            antecedent.Add(ab);
            antecedent.Add(inter);

            // PerpendicularBisector(M, Segment(M, C), Segment(A, B))
            Strengthened newPerpB = new Strengthened(inter, new PerpendicularBisector(inter, ab.bisector));
            newGrounded.Add(new EdgeAggregator(antecedent, newPerpB, annotation));

            return newGrounded;
        }
Ejemplo n.º 7
0
        //
        // Construct the AngleBisector if we have
        //
        //      V---------------A
        //     / \
        //    /   \
        //   /     \
        //  B       C
        //
        // Congruent(Angle, A, V, C), Angle(C, V, B)),  Segment(V, C)) -> AngleBisector(Angle(A, V, B)
        //
        //
        private static List<EdgeAggregator> InstantiateToDef(CongruentAngles cas, Segment segment)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Find the shared segment between the two angles; we know it is valid if we reach this point
            Segment shared = cas.AreAdjacent();

            // The bisector must align with the given segment
            if (!segment.IsCollinearWith(shared)) return newGrounded;

            // We need a true bisector in which the shared vertex of the angles in between the endpoints of this segment
            if (!segment.PointLiesOnAndBetweenEndpoints(cas.ca1.GetVertex())) return newGrounded;

            //
            // Create the overall angle which is being bisected
            //
            Point vertex = cas.ca1.GetVertex();
            Segment newRay1 = cas.ca1.OtherRayEquates(shared);
            Segment newRay2 = cas.ca2.OtherRayEquates(shared);
            Angle combinedAngle = new Angle(newRay1.OtherPoint(vertex), vertex, newRay2.OtherPoint(vertex));

            // Determine if the segment is a straight angle (we don't want an angle bisector here, we would want a segment bisector)
            if (newRay1.IsCollinearWith(newRay2)) return newGrounded;

            // The bisector cannot be of the form:
            //    \
            //     \
            //      V---------------A
            //     /
            //    /
            //   B
            if (!combinedAngle.IsOnInteriorExplicitly(segment.Point1) && !combinedAngle.IsOnInteriorExplicitly(segment.Point2)) return newGrounded;

            AngleBisector newAB = new AngleBisector(combinedAngle, segment);

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(segment);
            antecedent.Add(cas);

            newGrounded.Add(new EdgeAggregator(antecedent, newAB, annotation));
            return newGrounded;
        }