Ejemplo n.º 1
0
        protected override void BuildMeshComponents()
        {
            if (Vertices == null)
            {
                Vertices = new Vector3[3];
            }

            if (Triangles == null)
            {
                Triangles    = new int[3];
                Triangles[0] = 0;
                Triangles[1] = 2;
                Triangles[2] = 1;
            }

            Vertices[0] = p1;

            int sign = MeshHelper.GetSide(p2, p1, p3);

            if (sign == -1)
            {
                Vertices[1] = p2;
                Vertices[2] = p3;
            }
            else
            {
                Vertices[1] = p3;
                Vertices[2] = p2;
            }

            UVs = MeshHelper.UVUnwrap(Vertices);
        }
        //get vector of points on the right of two given setOfPoints
        private static List <Vector2> GetPointsOnRight(List <Vector2> setOfPoints, Vector2 vL, Vector2 vP)
        {
            List <Vector2> r = new List <Vector2>();

            for (int i = 0; i < setOfPoints.Count; i++)
            {
                if (MeshHelper.GetSide(setOfPoints[i], vL, vP) > 0)
                {
                    r.Add(setOfPoints[i]);
                }
            }
            return(r);
        }
Ejemplo n.º 3
0
        protected override bool ValidateMesh()
        {
            if (p1 == p2 || p2 == p3 || p3 == p1)
            {
                Debug.LogWarning("TriangleMesh::ValidateMesh: some of the points are identity!");
                return(false);
            }

            int sign = MeshHelper.GetSide(p2, p1, p3);

            if (sign == 0)
            {
                Debug.LogWarning("TriangleMesh::ValidateMesh: Given points are colinear!");
                return(false);
            }

            return(true);
        }
        protected override bool ValidateMesh()
        {
            if (P1 == P2 || P2 == P3 || P3 == P1)
            {
                Debug.LogWarning("TriangleMesh::ValidateMesh: some of the points are identity!");
                return(false);
            }

            int sign = MeshHelper.GetSide(P2, P1, P3);

            if (sign == 0)
            {
                Debug.LogWarning("TriangleMesh::ValidateMesh: Given points are colinear!");
                return(false);
            }

            return(true);
        }