private PointF[] GetProjected3DShape( CameraConfig videoCameraConfig, float zoomFactor, Point viewOffset, IntPtr shapeUnitCoeffPtr, uint shapeUnitCoeffCount, IntPtr animUnitCoeffPtr, uint animUnitCoeffCount, float scale, Vector3DF rotation, Vector3DF translation) { this.CheckPtrAndThrow(); PointF[] faceModelProjected3DShape = null; uint vertexCount = this.VertexCount; IntPtr faceModel3DVerticesPtr = IntPtr.Zero; if (shapeUnitCoeffPtr == IntPtr.Zero || shapeUnitCoeffCount == 0) { throw new ArgumentException("Invalid shape unit co-efficients", "shapeUnitCoeffPtr"); } if (animUnitCoeffPtr == IntPtr.Zero || animUnitCoeffCount == 0) { throw new ArgumentException("Invalid animation unit co-efficients", "animUnitCoeffPtr"); } if (vertexCount > 0) { try { faceModel3DVerticesPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Vector3DF)) * (int)vertexCount); this.faceTrackingModelPtr.GetProjectedShape( videoCameraConfig, zoomFactor, viewOffset, shapeUnitCoeffPtr, shapeUnitCoeffCount, animUnitCoeffPtr, animUnitCoeffCount, scale, ref rotation, ref translation, faceModel3DVerticesPtr, vertexCount); faceModelProjected3DShape = new PointF[vertexCount]; for (int i = 0; i < (int)vertexCount; i++) { IntPtr faceModel3DVerticesIthPtr; if (IntPtr.Size == 8) { // 64bit faceModel3DVerticesIthPtr = new IntPtr(faceModel3DVerticesPtr.ToInt64() + (i * Marshal.SizeOf(typeof(PointF)))); } else { // 32bit faceModel3DVerticesIthPtr = new IntPtr(faceModel3DVerticesPtr.ToInt32() + (i * Marshal.SizeOf(typeof(PointF)))); } faceModelProjected3DShape[i] = (PointF)Marshal.PtrToStructure(faceModel3DVerticesIthPtr, typeof(PointF)); } } finally { if (faceModel3DVerticesPtr != IntPtr.Zero) { Marshal.FreeHGlobal(faceModel3DVerticesPtr); } } } return faceModelProjected3DShape; }
public bool Equals(PointF other) { if (x != other.x) { return false; } return y == other.y; }