private static List<EdgeAggregator> InstantiateToAltitude(Triangle triangle, Perpendicular perp, GroundedClause original) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // Acquire the side of the triangle containing the intersection point // This point may or may not be directly on the triangle side Segment baseSegment = triangle.GetSegmentWithPointOnOrExtends(perp.intersect); if (baseSegment == null) return newGrounded; // The altitude must pass through the intersection point as well as the opposing vertex Point oppositeVertex = triangle.OtherPoint(baseSegment); Segment altitude = new Segment(perp.intersect, oppositeVertex); // The alitude must alig with the intersection if (!perp.ImpliesRay(altitude)) return newGrounded; // The opposing side must align with the intersection if (!perp.OtherSegment(altitude).IsCollinearWith(baseSegment)) return newGrounded; // // Create the new Altitude object // Altitude newAltitude = new Altitude(triangle, altitude); // For hypergraph List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(triangle); antecedent.Add(original); newGrounded.Add(new EdgeAggregator(antecedent, newAltitude, annotation)); // // Check if this induces a second altitude for a right triangle (although we don't know this is a strengthened triangle) // The intersection must be on the vertex of the triangle if (triangle.HasPoint(perp.intersect)) { Angle possRightAngle = new Angle(triangle.OtherPoint(new Segment(perp.intersect, oppositeVertex)), perp.intersect, oppositeVertex); if (triangle.HasAngle(possRightAngle)) { Altitude secondAltitude = new Altitude(triangle, new Segment(perp.intersect, oppositeVertex)); newGrounded.Add(new EdgeAggregator(antecedent, secondAltitude, annotation)); } } return newGrounded; }