Ejemplo n.º 1
0
        /// <summary>
        /// Get the Mesh triangles
        /// </summary>
        /// <returns>
        /// The face mesh triangles
        /// </returns>
        public FaceTriangle[] GetTriangles()
        {
            IntPtr trianglesPtr;
            uint   trianglesCount;

            this.CheckPtrAndThrow();
            this.faceTrackingModelPtr.GetTriangles(out trianglesPtr, out trianglesCount);
            FaceTriangle[] triangles = null;
            if (trianglesCount > 0)
            {
                triangles = new FaceTriangle[trianglesCount];
                for (int i = 0; i < trianglesCount; i++)
                {
                    triangles[i] = new FaceTriangle();
                    IntPtr trianglesIthPtr;
                    if (IntPtr.Size == 8)
                    {
                        // 64bit
                        trianglesIthPtr = new IntPtr(trianglesPtr.ToInt64() + (i * Marshal.SizeOf(typeof(FaceTriangle))));
                    }
                    else
                    {
                        // 32bit
                        trianglesIthPtr = new IntPtr(trianglesPtr.ToInt32() + (i * Marshal.SizeOf(typeof(FaceTriangle))));
                    }

                    triangles[i] = (FaceTriangle)Marshal.PtrToStructure(trianglesIthPtr, typeof(FaceTriangle));
                }
            }

            return(triangles);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the Mesh triangles
        /// </summary>
        /// <returns>
        /// The face mesh triangles
        /// </returns>
        public FaceTriangle[] GetTriangles()
        {
            IntPtr trianglesPtr;
            uint trianglesCount;
            this.CheckPtrAndThrow();
            this.faceTrackingModelPtr.GetTriangles(out trianglesPtr, out trianglesCount);
            FaceTriangle[] triangles = null;
            if (trianglesCount > 0)
            {
                triangles = new FaceTriangle[trianglesCount];
                for (int i = 0; i < trianglesCount; i++)
                {
                    triangles[i] = new FaceTriangle();
                    IntPtr trianglesIthPtr;
                    if (IntPtr.Size == 8)
                    {
                        // 64bit
                        trianglesIthPtr = new IntPtr(trianglesPtr.ToInt64() + (i * Marshal.SizeOf(typeof(FaceTriangle))));
                    }
                    else
                    {
                        // 32bit
                        trianglesIthPtr = new IntPtr(trianglesPtr.ToInt32() + (i * Marshal.SizeOf(typeof(FaceTriangle))));
                    }

                    triangles[i] = (FaceTriangle)Marshal.PtrToStructure(trianglesIthPtr, typeof(FaceTriangle));
                }
            }

            return triangles;
        }
Ejemplo n.º 3
0
 public bool Equals(FaceTriangle other)
 {
     return this.first == other.first && this.second == other.second && this.third == other.third;
 }
Ejemplo n.º 4
0
 public bool Equals(FaceTriangle other)
 {
     return(this.first == other.first && this.second == other.second && this.third == other.third);
 }