Exemplo n.º 1
0
        void TestCompareTo_ObjNotHalfedge_Helper()
        {
            HalfEdge edge   = Auxilaries.RandomHalfEdge();
            Vertex   vertex = Auxilaries.RandomVertex();

            edge.CompareTo(vertex);
        }
Exemplo n.º 2
0
        public void TestCompareTo_ObjEqualInEverything()
        {
            Vertex vertex = Auxilaries.RandomVertex();

            HalfEdge thisEdge  = new HalfEdge(vertex);
            HalfEdge otherEdge = new HalfEdge(vertex);

            HalfEdge twin = Auxilaries.RandomHalfEdge();

            thisEdge.Twin  = twin;
            otherEdge.Twin = twin;

            HalfEdge next = Auxilaries.RandomHalfEdge();

            thisEdge.Next  = next;
            otherEdge.Next = next;

            HalfEdge previous = Auxilaries.RandomHalfEdge();

            thisEdge.Previous  = previous;
            otherEdge.Previous = previous;

            int expected = 0;
            int actual   = thisEdge.CompareTo(otherEdge);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void TestEquals_IdxEqualNotEqualSameSizeDifferentEdges()
        {
            HalfEdge a = Auxilaries.RandomHalfEdge();
            HalfEdge b = Auxilaries.RandomHalfEdge();
            HalfEdge c = Auxilaries.RandomHalfEdge();
            HalfEdge d = Auxilaries.RandomHalfEdge();
            HalfEdge e = Auxilaries.RandomHalfEdge();

            Vector3 normal = Auxilaries.RandomNormal();

            Face thisFace = new Face(0, normal);

            thisFace.AddOuterComponent(a);
            thisFace.AddOuterComponent(b);
            thisFace.AddOuterComponent(c);
            thisFace.AddOuterComponent(d);

            Face otherFace = new Face(0, normal);

            otherFace.AddOuterComponent(a);
            otherFace.AddOuterComponent(b);
            otherFace.AddOuterComponent(e);
            otherFace.AddOuterComponent(d);

            Assert.IsFalse(thisFace.Equals(otherFace));
            Assert.IsFalse(otherFace.Equals(thisFace));
            Assert.AreNotEqual(thisFace.GetHashCode(), otherFace.GetHashCode());
        }
Exemplo n.º 4
0
        void TestCompareTo_ObjNotFace_Helper()
        {
            Face     face = Auxilaries.RandomFace();
            HalfEdge edge = Auxilaries.RandomHalfEdge();

            face.CompareTo(edge);
        }
Exemplo n.º 5
0
        public void TestEquals_EqualsDifferentOrder()
        {
            HalfEdge a = Auxilaries.RandomHalfEdge();
            HalfEdge b = Auxilaries.RandomHalfEdge();
            HalfEdge c = Auxilaries.RandomHalfEdge();
            HalfEdge d = Auxilaries.RandomHalfEdge();

            Vector3 normal = Auxilaries.RandomNormal();

            Face thisFace = new Face(0, normal);

            thisFace.AddOuterComponent(a);
            thisFace.AddOuterComponent(b);
            thisFace.AddOuterComponent(c);
            thisFace.AddOuterComponent(d);

            Face otherFace = new Face(0, normal);

            otherFace.AddOuterComponent(b);
            otherFace.AddOuterComponent(a);
            otherFace.AddOuterComponent(d);
            otherFace.AddOuterComponent(c);

            Assert.IsTrue(thisFace.Equals(otherFace));
            Assert.IsTrue(otherFace.Equals(thisFace));
            Assert.AreEqual(thisFace.GetHashCode(), otherFace.GetHashCode());
        }
Exemplo n.º 6
0
        void TestCompareTo_ObjNotVertex_Helper()
        {
            Vertex   vertex = Auxilaries.RandomVertex();
            HalfEdge edge   = Auxilaries.RandomHalfEdge();

            vertex.CompareTo(edge);
        }
Exemplo n.º 7
0
        public void XAndyAreNotEqual_OriginDifferent()
        {
            HalfEdge x = Auxilaries.RandomHalfEdge();
            HalfEdge y = Auxilaries.RandomHalfEdge();

            Assert.IsFalse(comparer.Equals(x, y));
            Assert.AreNotEqual(comparer.GetHashCode(x), comparer.GetHashCode(y));
        }
Exemplo n.º 8
0
        public void TestHasIncidentFace_HasIncidentFace()
        {
            HalfEdge edge = Auxilaries.RandomHalfEdge();

            edge.IncidentFace = new Face(0, Auxilaries.RandomNormal());

            Assert.IsTrue(edge.HasIncidentFace);
        }
Exemplo n.º 9
0
        public void YIsNull()
        {
            HalfEdge x = Auxilaries.RandomHalfEdge();
            HalfEdge y = null;

            Assert.IsFalse(comparer.Equals(x, y));
            Assert.AreNotEqual(comparer.GetHashCode(x), comparer.GetHashCode(y));
        }
Exemplo n.º 10
0
        public void TestHasDestination_HasDestination()
        {
            HalfEdge edge = Auxilaries.RandomHalfEdge();
            HalfEdge twin = Auxilaries.RandomHalfEdge();

            edge.Twin = twin;

            Assert.IsTrue(edge.HasDestination);
        }
Exemplo n.º 11
0
        public void TestHasNext_HasNext()
        {
            HalfEdge edge = Auxilaries.RandomHalfEdge();
            HalfEdge next = Auxilaries.RandomHalfEdge();

            edge.Next = next;

            Assert.IsTrue(edge.HasNext);
        }
Exemplo n.º 12
0
        public void TestHasPrevious_HasPrevious()
        {
            HalfEdge edge     = Auxilaries.RandomHalfEdge();
            HalfEdge previous = Auxilaries.RandomHalfEdge();

            edge.Previous = previous;

            Assert.IsTrue(edge.HasPrevious);
        }
Exemplo n.º 13
0
        public void TestCompareTo_ObjNull()
        {
            HalfEdge edge = Auxilaries.RandomHalfEdge();

            int expected = 1;
            int actual   = edge.CompareTo(null);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 14
0
        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());
        }
Exemplo n.º 15
0
        public void XAndyAreNotEqual_ValueIncidentEdgesDifferent()
        {
            Vector3 position = Auxilaries.RandomPosition();
            KeyValuePair <Vector3, Vertex> x = new KeyValuePair <Vector3, Vertex>(new Vector3(1, 2, 3), new Vertex(position));
            KeyValuePair <Vector3, Vertex> y = new KeyValuePair <Vector3, Vertex>(new Vector3(1, 2, 3), new Vertex(position));

            x.Value.AddIncidentEdge(Auxilaries.RandomHalfEdge());
            y.Value.AddIncidentEdge(Auxilaries.RandomHalfEdge());

            Assert.IsFalse(comparer.Equals(x, y));
            Assert.AreNotEqual(comparer.GetHashCode(x), comparer.GetHashCode(y));
        }
Exemplo n.º 16
0
        public void XAndyAreEqual_IncidentEdgesDifferent()
        {
            Vector3 positon = Auxilaries.RandomPosition();
            Vertex  x       = new Vertex(positon);
            Vertex  y       = new Vertex(positon);

            x.AddIncidentEdge(Auxilaries.RandomHalfEdge());
            y.AddIncidentEdge(Auxilaries.RandomHalfEdge());

            Assert.IsTrue(comparer.Equals(x, y));
            Assert.AreEqual(comparer.GetHashCode(x), comparer.GetHashCode(y));
        }
Exemplo n.º 17
0
        public void XAndyAreNotEqual_OuterComponentsDifferent()
        {
            int     idx    = 3;
            Vector3 normal = Auxilaries.RandomNormal();
            Face    x      = new Face(idx, normal);
            Face    y      = new Face(idx, normal);

            x.AddOuterComponent(Auxilaries.RandomHalfEdge());
            y.AddOuterComponent(Auxilaries.RandomHalfEdge());

            Assert.IsTrue(comparer.Equals(x, y));
            Assert.AreEqual(comparer.GetHashCode(x), comparer.GetHashCode(y));
        }
Exemplo n.º 18
0
        public void XAndyAreNotEqual_DestinationDifferent()
        {
            Vertex origin = Auxilaries.RandomVertex();

            HalfEdge x = new HalfEdge(origin);
            HalfEdge y = new HalfEdge(origin);

            x.Twin = Auxilaries.RandomHalfEdge();
            y.Twin = Auxilaries.RandomHalfEdge();

            Assert.IsFalse(comparer.Equals(x, y));
            Assert.AreNotEqual(comparer.GetHashCode(x), comparer.GetHashCode(y));
        }
Exemplo n.º 19
0
        public void XAndyAreEqual_PreviousDifferent()
        {
            Vertex origin      = Auxilaries.RandomVertex();
            Vertex destination = Auxilaries.RandomVertex();

            HalfEdge x = new HalfEdge(origin);
            HalfEdge y = new HalfEdge(origin);

            x.Twin = new HalfEdge(destination);
            y.Twin = new HalfEdge(destination);

            x.Previous = Auxilaries.RandomHalfEdge();
            y.Previous = Auxilaries.RandomHalfEdge();

            Assert.IsTrue(comparer.Equals(x, y));
            Assert.AreEqual(comparer.GetHashCode(x), comparer.GetHashCode(y));
        }
Exemplo n.º 20
0
        public void TestEquals_NotEqualDifferentNormals()
        {
            HalfEdge a = Auxilaries.RandomHalfEdge();
            HalfEdge b = Auxilaries.RandomHalfEdge();

            Face thisFace = new Face(0, Auxilaries.RandomNormal());

            thisFace.AddOuterComponent(a);
            thisFace.AddOuterComponent(b);

            Face otherFace = new Face(0, Auxilaries.RandomNormal());

            thisFace.AddOuterComponent(a);
            thisFace.AddOuterComponent(b);

            Assert.IsFalse(thisFace.Equals(otherFace));
            Assert.IsFalse(otherFace.Equals(thisFace));
            Assert.AreNotEqual(thisFace.GetHashCode(), otherFace.GetHashCode());
        }
Exemplo n.º 21
0
        public void TestEquals_IncidentEdgesNotEqual()
        {
            Vector3 position = Auxilaries.RandomPosition();

            Vertex thisVertex  = new Vertex(position);
            Vertex otherVertex = new Vertex(position);

            HalfEdge edge1 = Auxilaries.RandomHalfEdge();
            HalfEdge edge2 = Auxilaries.RandomHalfEdge();
            HalfEdge edge3 = Auxilaries.RandomHalfEdge();

            thisVertex.AddIncidentEdge(edge1);
            thisVertex.AddIncidentEdge(edge2);

            otherVertex.AddIncidentEdge(edge3);

            Assert.IsFalse(thisVertex.Equals(otherVertex));
            Assert.IsFalse(otherVertex.Equals(thisVertex));
            Assert.AreNotEqual(thisVertex.GetHashCode(), otherVertex.GetHashCode());
        }
Exemplo n.º 22
0
        public void TestCompareTo_ObjEqualInPositionLargerInNextTwinSet()
        {
            Vertex vertex = Auxilaries.RandomVertex();

            HalfEdge thisEdge  = new HalfEdge(vertex);
            HalfEdge otherEdge = new HalfEdge(vertex);

            HalfEdge twin = Auxilaries.RandomHalfEdge();

            thisEdge.Twin  = twin;
            otherEdge.Twin = twin;

            thisEdge.Next  = new HalfEdge(new Vertex(new Vector3(3, 4, 5)));
            otherEdge.Next = new HalfEdge(new Vertex(new Vector3(0, 1, 2)));

            int expected = +1;
            int actual   = thisEdge.CompareTo(otherEdge);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 23
0
        public void TestHasIncidentFace_HasNoIncidentFace()
        {
            HalfEdge edge = Auxilaries.RandomHalfEdge();

            Assert.IsFalse(edge.HasDestination);
        }
Exemplo n.º 24
0
        public void TestHasTwin_HasNoTwin()
        {
            HalfEdge edge = Auxilaries.RandomHalfEdge();

            Assert.IsFalse(edge.HasTwin);
        }
Exemplo n.º 25
0
        public void TestHasPrevious_HasNoPrevious()
        {
            HalfEdge edge = Auxilaries.RandomHalfEdge();

            Assert.IsFalse(edge.HasPrevious);
        }
Exemplo n.º 26
0
        public void TestHasNext_HasNoNext()
        {
            HalfEdge edge = Auxilaries.RandomHalfEdge();

            Assert.IsFalse(edge.HasNext);
        }
Exemplo n.º 27
0
        public void TestHasDestination_HasNoDestination()
        {
            HalfEdge edge = Auxilaries.RandomHalfEdge();

            Assert.IsFalse(edge.HasDestination);
        }