Beispiel #1
0
 // Given one of the angles in the pair, return the other
 public bool HasAngle(Angle cs)
 {
     if (cs.Equates(ca1))
     {
         return(true);
     }
     if (cs.Equates(ca2))
     {
         return(true);
     }
     return(false);
 }
Beispiel #2
0
 // Given one of the angles in the pair, return the other
 public Angle OtherAngle(Angle cs)
 {
     if (cs.Equates(ca1))
     {
         return(ca2);
     }
     if (cs.Equates(ca2))
     {
         return(ca1);
     }
     return(null);
 }
Beispiel #3
0
        //
        // 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);
        }
        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;
        }
Beispiel #5
0
        //
        // 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 double GetAngleMeasure(Angle thatAngle)
        {
            if (thatAngle == null)
            {
                // throw new ArgumentException("Why is the angle null?");
                return -1;
            }

            foreach (KeyValuePair<Angle, double> anglePair in angles)
            {
                if (thatAngle.Equates(anglePair.Key)) return anglePair.Value;
            }

            return -1;
        }
Beispiel #7
0
 // Given one of the angles in the pair, return the other
 public bool HasAngle(Angle cs)
 {
     if (cs.Equates(ca1)) return true;
     if (cs.Equates(ca2)) return true;
     return false;
 }
Beispiel #8
0
 // Given one of the angles in the pair, return the other
 public Angle OtherAngle(Angle cs)
 {
     if (cs.Equates(ca1)) return ca2;
     if (cs.Equates(ca2)) return ca1;
     return null;
 }