g.drawLine((int)p1.x,(int)p1.y,(int)(p1.x+im.x*joint.getMinDistance()),(int)(p1.y+im.y*joint.getMinDistance()));
g.setColor(Color.blue);
g.drawLine((int)(p1.x+im.x*joint.getMinDistance()),(int)(p1.y+im.y*joint.getMinDistance()),(int)(p1.x+im.x*joint.getMaxDistance()),(int)(p1.y+im.y*joint.getMaxDistance()));
}
if(j instanceof AngleJoint){
AngleJoint angleJoint = (AngleJoint)j;
Body b1 = angleJoint.getBody1();
Body b2 = angleJoint.getBody2();
float RA = j.getBody1().getRotation() + angleJoint.getRotateA();
float RB = j.getBody1().getRotation() + angleJoint.getRotateB();
Vector2f VA = new Vector2f((float) Math.cos(RA), (float) Math.sin(RA));
Vector2f VB = new Vector2f((float) Math.cos(RB), (float) Math.sin(RB));
Matrix2f R1 = new Matrix2f(b1.getRotation());
Matrix2f R2 = new Matrix2f(b2.getRotation());
ROVector2f x1 = b1.getPosition();
Vector2f p1 = MathUtil.mul(R1,angleJoint.getAnchor1());
p1.add(x1);
ROVector2f x2 = b2.getPosition();
Vector2f p2 = MathUtil.mul(R2,angleJoint.getAnchor2());
p2.add(x2);
g.setColor(Color.red);
g.drawLine((int)p1.x,(int)p1.y,(int)(p1.x+VA.x*20),(int)(p1.y+VA.y*20));
g.drawLine((int)p1.x,(int)p1.y,(int)(p1.x+VB.x*20),(int)(p1.y+VB.y*20));