public void TestEquals_EqualBothIncidentFacesSet() { Vertex a = Auxilaries.RandomVertex(); Vertex b = Auxilaries.RandomVertex(); Vertex c = Auxilaries.RandomVertex(); HalfEdge abOther = new HalfEdge(a); HalfEdge abThis = new HalfEdge(a); HalfEdge ac = new HalfEdge(a); HalfEdge ba = new HalfEdge(b); HalfEdge bc = new HalfEdge(b); HalfEdge ca = new HalfEdge(c); HalfEdge cb = new HalfEdge(c); Face face = new Face(2, Auxilaries.RandomNormal()); face.AddOuterComponent(abThis); face.AddOuterComponent(bc); face.AddOuterComponent(ca); abThis.IncidentFace = face; abOther.IncidentFace = face; abThis.Twin = ba; abOther.Twin = ba; ac.Twin = ca; ba.Twin = abThis; bc.Twin = bc; ca.Twin = ac; cb.Twin = bc; abThis.Next = bc; abOther.Next = bc; ac.Next = cb; ba.Next = ac; bc.Next = ca; ca.Next = abThis; cb.Next = ba; abThis.Previous = ca; abOther.Previous = ca; ac.Previous = ba; ba.Previous = cb; bc.Previous = abThis; ca.Previous = bc; cb.Previous = ac; Assert.AreEqual(abThis.GetHashCode(), abOther.GetHashCode()); Assert.IsTrue(abThis.Equals(abOther)); Assert.IsTrue(abOther.Equals(abThis)); }
public void TestEquals_NotEqualOriginDifferent() { HalfEdge thisEdge = Auxilaries.RandomHalfEdge(); HalfEdge otherEdge = Auxilaries.RandomHalfEdge(); Assert.IsFalse(thisEdge.Equals(otherEdge)); Assert.IsFalse(otherEdge.Equals(thisEdge)); Assert.AreNotEqual(thisEdge.GetHashCode(), otherEdge.GetHashCode()); }
public void TestEquals_EqualsNoTwins() { Vertex origin = Auxilaries.RandomVertex(); HalfEdge thisEdge = new HalfEdge(origin); HalfEdge otherEdge = new HalfEdge(origin); Assert.IsTrue(thisEdge.Equals(otherEdge)); Assert.IsTrue(otherEdge.Equals(thisEdge)); Assert.AreEqual(thisEdge.GetHashCode(), otherEdge.GetHashCode()); }
public void TestEquals_EqualsAllPropertiesSet() { Vertex a = Auxilaries.RandomVertex(); Vertex b = Auxilaries.RandomVertex(); Vertex c = Auxilaries.RandomVertex(); HalfEdge abOther = new HalfEdge(a); HalfEdge abThis = new HalfEdge(a); HalfEdge ac = new HalfEdge(a); HalfEdge ba = new HalfEdge(b); HalfEdge bc = new HalfEdge(b); HalfEdge ca = new HalfEdge(c); HalfEdge cb = new HalfEdge(c); abThis.Twin = ba; abOther.Twin = ba; ac.Twin = ca; ba.Twin = abThis; bc.Twin = bc; ca.Twin = ac; cb.Twin = bc; abThis.Next = bc; abOther.Next = bc; ac.Next = cb; ba.Next = ac; bc.Next = ca; ca.Next = abThis; cb.Next = ba; abThis.Previous = ca; abOther.Previous = ca; ac.Previous = ba; ba.Previous = cb; bc.Previous = abThis; ca.Previous = bc; cb.Previous = ac; Assert.IsTrue(abThis.Equals(abOther)); Assert.IsTrue(abOther.Equals(abThis)); Assert.AreEqual(abThis.GetHashCode(), abOther.GetHashCode()); }
public void TestEquals_EqualsWithTwins() { Vertex origin = Auxilaries.RandomVertex(); Vertex destination = Auxilaries.RandomVertex(); HalfEdge thisEdge = new HalfEdge(origin); HalfEdge otherEdge = new HalfEdge(origin); HalfEdge twin = new HalfEdge(destination); thisEdge.Twin = twin; otherEdge.Twin = twin; twin.Twin = thisEdge; Assert.IsTrue(thisEdge.Equals(otherEdge)); Assert.IsTrue(otherEdge.Equals(thisEdge)); Assert.AreEqual(thisEdge.GetHashCode(), otherEdge.GetHashCode()); }
public void TestEquals_NotEqualPreviousDifferent() { Vertex origin = Auxilaries.RandomVertex(); Vertex destination = Auxilaries.RandomVertex(); Vertex thisPreviousOrigin = Auxilaries.RandomVertex(); Vertex otherPreviousOrigin = Auxilaries.RandomVertex(); HalfEdge thisEdge = new HalfEdge(origin); thisEdge.Twin = new HalfEdge(destination); thisEdge.Previous = new HalfEdge(thisPreviousOrigin); thisEdge.Previous.Twin = new HalfEdge(origin); HalfEdge otherEdge = new HalfEdge(origin); otherEdge.Twin = new HalfEdge(destination); otherEdge.Previous = new HalfEdge(otherPreviousOrigin); otherEdge.Previous.Twin = new HalfEdge(origin); Assert.IsFalse(thisEdge.Equals(otherEdge)); Assert.IsFalse(otherEdge.Equals(thisEdge)); Assert.AreNotEqual(thisEdge.GetHashCode(), otherEdge.GetHashCode()); }
public void TestEquals_NotEqualTwinDifferent() { Vertex origin = Auxilaries.RandomVertex(); Vertex thisDestination = Auxilaries.RandomVertex(); Vertex otherDestination = Auxilaries.RandomVertex(); HalfEdge thisEdge = new HalfEdge(origin); HalfEdge otherEdge = new HalfEdge(origin); HalfEdge thisEdgeTwin = new HalfEdge(thisDestination); thisEdge.Twin = thisEdgeTwin; thisEdgeTwin.Twin = thisEdge; HalfEdge otherEdgeTwin = new HalfEdge(otherDestination); otherEdge.Twin = new HalfEdge(otherDestination); otherEdgeTwin.Twin = otherEdge; Assert.IsFalse(thisEdge.Equals(otherEdge)); Assert.IsFalse(otherEdge.Equals(thisEdge)); Assert.AreNotEqual(thisEdge.GetHashCode(), otherEdge.GetHashCode()); }
public void TestEquals_NotEqualsDifferentIncidentFaces() { Vertex a = Auxilaries.RandomVertex(); Vertex b = Auxilaries.RandomVertex(); Vertex c = Auxilaries.RandomVertex(); HalfEdge abOther = new HalfEdge(a); HalfEdge abThis = new HalfEdge(a); HalfEdge ac = new HalfEdge(a); HalfEdge ba = new HalfEdge(b); HalfEdge bc = new HalfEdge(b); HalfEdge ca = new HalfEdge(c); HalfEdge cb = new HalfEdge(c); Vector3 normal = Auxilaries.RandomNormal(); Face thisFace = new Face(0, normal); thisFace.AddOuterComponent(abThis); thisFace.AddOuterComponent(bc); thisFace.AddOuterComponent(ca); Face otherFace = new Face(1, normal); otherFace.AddOuterComponent(abOther); abThis.IncidentFace = thisFace; abOther.IncidentFace = otherFace; abThis.Twin = ba; abOther.Twin = ba; ac.Twin = ca; ba.Twin = abThis; bc.Twin = bc; ca.Twin = ac; cb.Twin = bc; abThis.Next = bc; abOther.Next = bc; ac.Next = cb; ba.Next = ac; bc.Next = ca; ca.Next = abThis; cb.Next = ba; abThis.Previous = ca; abOther.Previous = ca; ac.Previous = ba; ba.Previous = cb; bc.Previous = abThis; ca.Previous = bc; cb.Previous = ac; Assert.AreNotEqual(abThis.GetHashCode(), abOther.GetHashCode()); Assert.IsFalse(abThis.Equals(abOther)); Assert.IsFalse(abOther.Equals(abThis)); }