Ejemplo n.º 1
0
        public RotateJointTransform(int degrees, BodyPlaneType plane, RotationDirection rotationDirection = RotationDirection.Clockwise)
            : base(
                joint =>
        {
            double cosInput = TrigonometryHelper.GetCosine(degrees);
            double sinInput = TrigonometryHelper.GetSine(degrees);

            if (rotationDirection == RotationDirection.CounterClockwise)
            {
                sinInput = -sinInput;
            }

            var cos    = Z3Math.Real(cosInput);
            var sin    = Z3Math.Real(sinInput);
            var sinNeg = Z3Math.Real(-sinInput);

            Z3Point3D result = new Z3Point3D(joint.X, joint.Y, joint.Z);

            switch (plane)
            {
            case BodyPlaneType.Frontal:
                result.Y = Z3Math.Add(Z3Math.Mul(cos, joint.Y), Z3Math.Mul(sin, joint.Z));
                result.Z = Z3Math.Add(Z3Math.Mul(sinNeg, joint.Y), Z3Math.Mul(cos, joint.Z));
                break;

            case BodyPlaneType.Sagittal:
                result.X = Z3Math.Add(Z3Math.Mul(cos, joint.X), Z3Math.Mul(sin, joint.Y));
                result.Y = Z3Math.Add(Z3Math.Mul(sinNeg, joint.X), Z3Math.Mul(cos, joint.Y));
                break;

            case BodyPlaneType.Horizontal:
                result.X = Z3Math.Add(Z3Math.Mul(cos, joint.X), Z3Math.Mul(sin, joint.Z));
                result.Z = Z3Math.Add(Z3Math.Mul(sinNeg, joint.X), Z3Math.Mul(cos, joint.Z));
                break;

            default:
                break;
            }

            return(result);
        })
        { }
Ejemplo n.º 2
0
        /// <summary>
        /// initializes and places a Medical plane according to anatomical placement
        /// </summary>
        /// <param name="plane"></param>
        private MedicalPlane createPlane(BodyPlaneType plane)
        {
            GameObject planeObject;

            switch (plane)
            {
            case BodyPlaneType.coronal:
            { planeObject = Instantiate(Resources.Load("CoronalPlane"), PlaneParent.transform) as GameObject; }
            break;

            case BodyPlaneType.saggital:
            {
                planeObject = Instantiate(Resources.Load("SaggitalPlane"), PlaneParent.transform) as GameObject;
            }
            break;

            case BodyPlaneType.transverse:
            {
                planeObject = Instantiate(Resources.Load("TransversePlane"), PlaneParent.transform) as GameObject;
            }
            break;

            default:
            {
                planeObject = new GameObject();
                Debug.LogError("AnatomyEnabler for " + gameObject.name + "is trying to create a non-normal plane");
            }
            break;
            }
            MedicalPlane newPlane = planeObject.GetComponent <MedicalPlane>() as MedicalPlane;

            if (newPlane == null)
            {
                Debug.LogError("warning, medicalPlane script not found on the new plane. Check and make sure it's added to your plane");
            }
            newPlane.Initialize(m_visualBoundingBox);

            return(newPlane);
        }
Ejemplo n.º 3
0
 public static CompositeBodyTransform RotateTransform(JointType jointType, int degrees, BodyPlaneType plane, RotationDirection direction)
 {
     return(new CompositeBodyTransform(jointType, new RotateJointTransform(degrees, plane, direction)));
 }
Ejemplo n.º 4
0
 internal Wrapper(BodyPlaneType planeType)
 {
     this.value = planeType;
 }
Ejemplo n.º 5
0
        public RotateJointTransform(int degrees, BodyPlaneType plane, RotationDirection rotationDirection = RotationDirection.Clockwise)
            : base(joint =>
            {
                double cosInput = TrigonometryHelper.GetCosine(degrees);
                double sinInput = TrigonometryHelper.GetSine(degrees);

                if (rotationDirection == RotationDirection.CounterClockwise)
                    sinInput = -sinInput;

                var cos = Z3Math.Real(cosInput);
                var sin = Z3Math.Real(sinInput);
                var sinNeg = Z3Math.Real(-sinInput);

                Z3Point3D result = new Z3Point3D(joint.X, joint.Y, joint.Z);

                switch (plane)
                {
                    case BodyPlaneType.Frontal:
                        result.Y = Z3Math.Add(Z3Math.Mul(cos, joint.Y), Z3Math.Mul(sin, joint.Z));
                        result.Z = Z3Math.Add(Z3Math.Mul(sinNeg, joint.Y), Z3Math.Mul(cos, joint.Z));
                        break;

                    case BodyPlaneType.Sagittal:
                        result.X = Z3Math.Add(Z3Math.Mul(cos, joint.X), Z3Math.Mul(sin, joint.Y));
                        result.Y = Z3Math.Add(Z3Math.Mul(sinNeg, joint.X), Z3Math.Mul(cos, joint.Y));
                        break;

                    case BodyPlaneType.Horizontal:
                        result.X = Z3Math.Add(Z3Math.Mul(cos, joint.X), Z3Math.Mul(sin, joint.Z));
                        result.Z = Z3Math.Add(Z3Math.Mul(sinNeg, joint.X), Z3Math.Mul(cos, joint.Z));
                        break;

                    default:
                        break;
                }

                return result;
            })
        {
        }
Ejemplo n.º 6
0
 public static BodyTransform RotateTransform(JointType jointType, int angle, BodyPlaneType plane, RotationDirection direction)
 {
     return new BodyTransform(jointType, new RotateJointTransform(angle, plane, direction));
 }
Ejemplo n.º 7
0
 public static CompositeBodyTransform RotateTransform(JointType jointType, int degrees, BodyPlaneType plane, RotationDirection direction)
 {
     return new CompositeBodyTransform(jointType, new RotateJointTransform(degrees, plane, direction));
 }
Ejemplo n.º 8
0
 public static BodyTransform RotateTransform(JointType jointType, int angle, BodyPlaneType plane, RotationDirection direction)
 {
     return(new BodyTransform(jointType, new RotateJointTransform(angle, plane, direction)));
 }