Example #1
0
        private int AddBone(int bodyIdx, JointType jointType0, JointType jointType1, int startIdx)
        {
            Point3f joint0 = bodies[bodyIdx].lJoints[(int)jointType0].position;
            Point3f joint1 = bodies[bodyIdx].lJoints[(int)jointType1].position;

            AddLine(startIdx, joint0.X, joint0.Y, joint0.Z, joint1.X, joint1.Y, joint1.Z);
            return(2);
        }
Example #2
0
        public static Point3f Apply3DTransform(Point3f point, AffineTransform transform)
        {
            Point3f newPoint = new Point3f();

            //matrix multiplication
            newPoint.X = (transform.R[0, 0] * point.X) + (transform.R[0, 1] * point.Y) + (transform.R[0, 2] * point.Z) + transform.t[0];
            newPoint.Y = (transform.R[1, 0] * point.X) + (transform.R[1, 1] * point.Y) + (transform.R[1, 2] * point.Z) + transform.t[1];
            newPoint.Z = (transform.R[2, 0] * point.X) + (transform.R[2, 1] * point.Y) + (transform.R[2, 2] * point.Z) + transform.t[2];
            return(newPoint);
        }
Example #3
0
        //parse list of vertices received by client into list of point3f to allow transformations
        public static List <Point3f> VerticesToPoint3f(List <Single> vertices)
        {
            if (vertices.Count % 3 != 0)
            {
                throw new System.ArgumentOutOfRangeException("list of vertices must divide by 3");
            }

            List <Point3f> points = new List <Point3f>();

            for (int i = 0; i < vertices.Count / 3; i++)
            {
                var point = new Point3f();

                point.X = vertices[i * 3];
                point.Y = vertices[i * 3 + 1];
                point.Z = vertices[i * 3 + 2];

                points.Add(point);
            }

            return(points);
        }