public static List <GenericInstantiator.EdgeAggregator> GenerateCorrespondingParts(List <KeyValuePair <Point, Point> > pairs, List <GroundedClause> antecedent, Hypergraph.EdgeAnnotation givenAnnotation) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); // If pairs is populated, we have a Similiarity if (!pairs.Any()) { return(newGrounded); } // Create the similarity between the triangles List <Point> triangleOne = new List <Point>(); List <Point> triangleTwo = new List <Point>(); foreach (KeyValuePair <Point, Point> pair in pairs) { triangleOne.Add(pair.Key); triangleTwo.Add(pair.Value); } GeometricSimilarTriangles simTris = new GeometricSimilarTriangles(new Triangle(triangleOne), new Triangle(triangleTwo)); newGrounded.Add(new EdgeAggregator(antecedent, simTris, givenAnnotation)); // Add all the corresponding parts as new Similar clauses newGrounded.AddRange(SimilarTriangles.GenerateComponents(simTris, triangleOne, triangleTwo)); return(newGrounded); }
// // Checks for AA given the 4 values // private static List <EdgeAggregator> InstantiateAASimilarity(Triangle tri1, Triangle tri2, CongruentAngles cas1, CongruentAngles cas2) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); // // All congruence pairs must minimally relate the triangles // if (!cas1.LinksTriangles(tri1, tri2)) { return(newGrounded); } if (!cas2.LinksTriangles(tri1, tri2)) { return(newGrounded); } // Is this angle an 'extension' of the actual triangle angle? If so, acquire the normalized version of // the angle, using only the triangle vertices to represent the angle Angle angle1Tri1 = tri1.NormalizeAngle(tri1.AngleBelongs(cas1)); Angle angle1Tri2 = tri2.NormalizeAngle(tri2.AngleBelongs(cas1)); Angle angle2Tri1 = tri1.NormalizeAngle(tri1.AngleBelongs(cas2)); Angle angle2Tri2 = tri2.NormalizeAngle(tri2.AngleBelongs(cas2)); // The angles for each triangle must be distinct if (angle1Tri1.Equals(angle2Tri1) || angle1Tri2.Equals(angle2Tri2)) { return(newGrounded); } // // Construct the corrsesponding points between the triangles // List <Point> triangleOne = new List <Point>(); List <Point> triangleTwo = new List <Point>(); triangleOne.Add(angle1Tri1.GetVertex()); triangleTwo.Add(angle1Tri2.GetVertex()); triangleOne.Add(angle2Tri1.GetVertex()); triangleTwo.Add(angle2Tri2.GetVertex()); // We know the segment endpoint mappings above, now acquire the opposite point triangleOne.Add(tri1.OtherPoint(new Segment(angle1Tri1.GetVertex(), angle2Tri1.GetVertex()))); triangleTwo.Add(tri2.OtherPoint(new Segment(angle1Tri2.GetVertex(), angle2Tri2.GetVertex()))); // // Construct the new clauses: similar triangles and resultant components // GeometricSimilarTriangles simTris = new GeometricSimilarTriangles(new Triangle(triangleOne), new Triangle(triangleTwo)); // Hypergraph edge List <GroundedClause> antecedent = new List <GroundedClause>(); antecedent.Add(tri1); antecedent.Add(tri2); antecedent.Add(cas1); antecedent.Add(cas2); newGrounded.Add(new EdgeAggregator(antecedent, simTris, annotation)); // Add all the corresponding parts as new Similar clauses newGrounded.AddRange(SimilarTriangles.GenerateComponents(simTris, triangleOne, triangleTwo)); return(newGrounded); }