public static GeometryUtility.CPoint2D[] ToCPoint2D(this Vector3[] points)
 {
     GeometryUtility.CPoint2D[] ret = new GeometryUtility.CPoint2D[points.Length];
     for (int i = 0; i < points.Length; i++)
     {
         ret[i] = new GeometryUtility.CPoint2D(points[i].x, points[i].z);
     }
     return(ret);
 }
        public void GenerateTriangles()
        {
            GeometryUtility.CPoint2D[] polyVertices = new GeometryUtility.CPoint2D[PointVms.Count];

            int i = 0;

            foreach (LfDragablePointViewModel dpvm in PointVms)
            {
                // Before triangles are generated we must reorder the identities of the
                // vertices to make them consequtive
                dpvm.Id = (uint)(i + 1);

                polyVertices[i] = new GeometryUtility.CPoint2D(dpvm.PosX, dpvm.PosY, dpvm.Id);

                i++;
            }

            PolygonCuttingEar.CPolygonShape poly = new PolygonCuttingEar.CPolygonShape(polyVertices);

            poly.CutEar();

            if (LocalModelObject != null)
            {
                LocalModelObject.Triangles.Clear();
                _triangles.Clear();

                for (int n = 0; n < poly.NumberOfPolygons; n++)
                {
                    Triangle nt = new Triangle((uint)n + 1, poly.Polygons(n)[0].Id, poly.Polygons(n)[1].Id, poly.Polygons(n)[2].Id);
                    LocalModelObject.Triangles.Add(nt);

                    TriangleViewModel ntvm = new TriangleViewModel(this, nt);
                    _triangles.Add(ntvm);
                }
            }
        }
        public static Vector3 ToVector3(this GeometryUtility.CPoint2D point, float yHeight)
        {
            Vector3 ret = new Vector3((float)point.X, yHeight, (float)point.Y);

            return(ret);
        }