Ejemplo n.º 1
0
        public void Vector3iCross()
        {
            Vector3i
                p        = new Vector3i(1, 2, 3),
                q        = new Vector3i(2, 3, 4),
                actual   = p.Cross(q),
                expected = new Vector3i(-1, 2, -1);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        private void AddTriangle(int index, Vector3i posA, Vector3i posB, Vector3i posC)
        {
            Vertices[index * 3 + 0] = posA.ToVector3();
            Vertices[index * 3 + 1] = posB.ToVector3();
            Vertices[index * 3 + 2] = posC.ToVector3();

            UV[index * 3 + 0] = new Vector2(posA.x, posA.y);
            UV[index * 3 + 1] = new Vector2(posB.x, posB.y);
            UV[index * 3 + 2] = new Vector2(posC.x, posC.y);

            var side1  = posB - posA;
            var side2  = posC - posA;
            var normal = Vector3i.Cross(side1, side2).normalized;

            Normals[index * 3 + 0] = normal;
            Normals[index * 3 + 1] = normal;
            Normals[index * 3 + 2] = normal;
        }
Ejemplo n.º 3
0
 public static Vector3i Cross(Vector3i a, Vector3i b)
 {
     return(Vector3i.Cross(a, b));
 }