Example #1
0
        public SpringConstraint( Particle p1, Particle p2 )
        {
            this.p1 = p1;
            this.p2 = p2;
            restLength = p1.Curr.Distance( p2.Curr );

            stiffness = 0.5;
            visible = true;
        }
Example #2
0
        public AngularConstraint( Particle p1, Particle p2, Particle p3 )
        {
            pA = p1.Curr;
            pB = p2.Curr;
            pC = p3.Curr;

            lineA = new Line( pA, pB );
            lineB = new Line( pB, pC );

            // lineC is the reference line for getting the angle of the line segments
            pD = new Vector( pB.X + 0, pB.Y - 1 );
            lineC = new Line( pB, pD );

            // theta to constrain to -- domain is -Math.PI to Math.PI
            targetTheta = CalcTheta( pA, pB, pC );

            // coefficient of stiffness
            stiffness = 1;
        }