// // Just generate the new angle congruence // private static List<EdgeAggregator> InstantiateToCongruence(Triangle tri, CongruentSegments css) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); if (!tri.HasSegment(css.cs1) || !tri.HasSegment(css.cs2)) return newGrounded; GeometricCongruentAngles newConAngs = new GeometricCongruentAngles(tri.GetOppositeAngle(css.cs1), tri.GetOppositeAngle(css.cs2)); List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(css); antecedent.Add(tri); newGrounded.Add(new EdgeAggregator(antecedent, newConAngs, annotation)); return newGrounded; }
public KeyValuePair <Segment, Segment> GetSegments(Triangle tri) { // Collect the applicable segments. List <Segment> theseSegments = new List <Segment>(); foreach (Segment segment in segments) { if (tri.HasSegment(segment)) { theseSegments.Add(segment); } } // Check for error condition if (theseSegments.Count != 2) { return(new KeyValuePair <Segment, Segment>(null, null)); } // Place the larger segment first KeyValuePair <Segment, Segment> pair; if (theseSegments[0].Length > theseSegments[1].Length) { pair = new KeyValuePair <Segment, Segment>(theseSegments[0], theseSegments[1]); } else { pair = new KeyValuePair <Segment, Segment>(theseSegments[1], theseSegments[0]); } return(pair); }
//// Return the number of shared segments in both congruences //public int SharesNumClauses(CongruentSegments thatCS) //{ // //CongruentSegments css = thatPS as CongruentSegments; // //if (css == null) return 0; // int numShared = smallerSegment.Equals(thatCS.cs1) || smallerSegment.Equals(thatCS.cs2) ? 1 : 0; // numShared += largerSegment.Equals(thatCS.cs1) || largerSegment.Equals(thatCS.cs2) ? 1 : 0; // return numShared; //} // // This equation must be able to relate two segments from triangle 1 and two from triangle 2 // public bool LinksTriangles(Triangle ct1, Triangle ct2) { int count1 = 0; int count2 = 0; bool[] marked = new bool[segments.Count]; for (int s = 0; s < segments.Count; s++) { if (ct1.HasSegment(segments[s])) { marked[s] = true; count1++; } if (ct2.HasSegment(segments[s])) { marked[s] = true; count2++; } } if (marked.Contains(false)) { return(false); } return(count1 == 2 && count2 == 2); }
public bool LinksTriangles(Triangle ct1, Triangle ct2) { return ct1.HasSegment(cs1) && ct2.HasSegment(cs2) || ct1.HasSegment(cs2) && ct2.HasSegment(cs1); }
public bool LinksTriangles(Triangle ct1, Triangle ct2) { return (ct1.HasSegment(smallerSegment) && ct2.HasSegment(largerSegment)) || (ct1.HasSegment(largerSegment) && ct2.HasSegment(smallerSegment)); }
private static List<EdgeAggregator> InstantiateToDefinition(Triangle tri, CongruentSegments cs1, CongruentSegments cs2) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // Do these congruences relate one common segment? Segment shared = cs1.SharedSegment(cs2); if (shared == null) return newGrounded; // // Do these congruences apply to this triangle? // if (!tri.HasSegment(cs1.cs1) || !tri.HasSegment(cs1.cs2)) return newGrounded; if (!tri.HasSegment(cs2.cs1) || !tri.HasSegment(cs2.cs2)) return newGrounded; // // These cannot be reflexive congruences. // if (cs1.IsReflexive() || cs2.IsReflexive()) return newGrounded; // // Are the non-shared segments unique? // Segment other1 = cs1.OtherSegment(shared); Segment other2 = cs2.OtherSegment(shared); if (other1.StructurallyEquals(other2)) return newGrounded; // // Generate the new equialteral clause // Strengthened newStrengthened = new Strengthened(tri, new EquilateralTriangle(tri)); List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(cs1); antecedent.Add(cs2); antecedent.Add(tri); newGrounded.Add(new EdgeAggregator(antecedent, newStrengthened, annotation)); return newGrounded; }
public KeyValuePair<Segment, Segment> GetSegments(Triangle tri) { // Collect the applicable segments. List<Segment> theseSegments = new List<Segment>(); foreach (Segment segment in segments) { if (tri.HasSegment(segment)) theseSegments.Add(segment); } // Check for error condition if (theseSegments.Count != 2) return new KeyValuePair<Segment, Segment>(null, null); // Place the larger segment first KeyValuePair<Segment, Segment> pair; if (theseSegments[0].Length > theseSegments[1].Length) { pair = new KeyValuePair<Segment, Segment>(theseSegments[0], theseSegments[1]); } else { pair = new KeyValuePair<Segment, Segment>(theseSegments[1], theseSegments[0]); } return pair; }
//// Return the number of shared segments in both congruences //public int SharesNumClauses(CongruentSegments thatCS) //{ // //CongruentSegments css = thatPS as CongruentSegments; // //if (css == null) return 0; // int numShared = smallerSegment.Equals(thatCS.cs1) || smallerSegment.Equals(thatCS.cs2) ? 1 : 0; // numShared += largerSegment.Equals(thatCS.cs1) || largerSegment.Equals(thatCS.cs2) ? 1 : 0; // return numShared; //} // // This equation must be able to relate two segments from triangle 1 and two from triangle 2 // public bool LinksTriangles(Triangle ct1, Triangle ct2) { int count1 = 0; int count2 = 0; bool[] marked = new bool[segments.Count]; for (int s = 0; s < segments.Count; s++) { if (ct1.HasSegment(segments[s])) { marked[s] = true; count1++; } if (ct2.HasSegment(segments[s])) { marked[s] = true; count2++; } } if (marked.Contains(false)) return false; return count1 == 2 && count2 == 2; }
public bool LinksTriangles(Triangle ct1, Triangle ct2) { return((ct1.HasSegment(smallerSegment) && ct2.HasSegment(largerSegment)) || (ct1.HasSegment(largerSegment) && ct2.HasSegment(smallerSegment))); }
public bool LinksTriangles(Triangle ct1, Triangle ct2) { return(ct1.HasSegment(cs1) && ct2.HasSegment(cs2) || ct1.HasSegment(cs2) && ct2.HasSegment(cs1)); }