Ejemplo n.º 1
0
        public static CoordSys CalculateCoordSystem(IReadOnlyList <CameraSpacePoint> vertices)
        {
            CameraSpacePoint noseTip        = vertices[18];
            CameraSpacePoint foreheadCenter = vertices[28];
            CameraSpacePoint leftCheekBone  = vertices[458];

            CameraSpacePoint avgPoint = new CameraSpacePoint()
            {
                X = vertices.Average(a => a.X),
                Y = vertices.Average(a => a.Y),
                Z = vertices.Average(a => a.Z)
            };

            CameraSpacePoint translTop   = avgPoint.SubtractFrom(foreheadCenter);
            CameraSpacePoint translFront = avgPoint.SubtractFrom(noseTip);
            CameraSpacePoint translSide  = avgPoint.SubtractFrom(leftCheekBone);

            return(Utilities.GramSchmidt(translFront, translTop, translSide, avgPoint));
        }