Example #1
0
 /// <summary>
 /// Contructor of a constraint.
 /// </summary>
 /// <param name="baseJoint"></param>
 /// <param name="legJointOne"></param>
 /// <param name="legJointTwo"></param>
 public CustomConstraint(CustomJoint baseJoint, CustomJoint legJointOne, CustomJoint legJointTwo, double tolerance)
 {
     this.baseJoint = baseJoint;
     this.legJointOne = legJointOne;
     this.legJointTwo = legJointTwo;
     this.tolerance = tolerance;
     calcAngles();
 }
Example #2
0
        /// <summary>
        /// Constructor for a bone-class.
        /// </summary>
        /// <param name="jOne">One joint.</param>
        /// <param name="jTwo">The other joint.</param>
        public CustomBone(CustomJoint jOne, CustomJoint jTwo)
        {
            this.jOne = jOne;
            this.jTwo = jTwo;

            boneLine = new Line();
            boneLine.Stroke = System.Windows.Media.Brushes.Black;
            // the +10 is neccessary to draw the line between the centers of two ellipses (joints)
            boneLine.X1 = jOne.getX() + 10;
            boneLine.X2 = jTwo.getX() + 10;
            boneLine.Y1 = jOne.getY() + 10;
            boneLine.Y2 = jTwo.getY() + 10;
            boneLine.StrokeThickness = 3;

            // handler to react on the movement of the joints in dragging-mode
            jOne.Event_onJointIsMoving += new OnJointIsMovingHandler(OnJointOneIsMoving);
            jTwo.Event_onJointIsMoving += new OnJointIsMovingHandler(OnJointTwoIsMoving);
        }