Ball&Socket unit for v3.14

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Ball&Socket unit for v3.14

Postby blackbird_dream » Tue Oct 10, 2023 5:43 am

Hi friends,
I am looking for a FPC unit (.pas) for Ball&Socketjoints compatible with NG v3.14
Preferably I need to retrieve the 3 angle values (there are 3 dofs in a B&SJoint) and not only ConeAngle and Twistangle,
but at least something working fine with angle limits.
Thks beforehand.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: Ball&Socket unit for v3.14

Postby blackbird_dream » Wed Oct 25, 2023 3:51 am

The solution I found is to use a simple-hinge ontop of a double-hinge.
The double hinge is driveable through 2 angles alpha and beta.
It's equivalent to a rotation around Y-axis with angle alpha and a rotation around Z initial axis with angle Arctan(tan(alpha)*cos(beta));
As it is designed, the double-hinge angle values returned are the angles alpha, beta between the pin-axis and the (x,y) and (x,z) plane respectively :

Code: Select all
// One row to restrict rotation around the parent coordinate system
  FrontDir:=vectorsubtract(matrix0.V[1],vectorscale(matrix1.V[2],Vectordotproduct(matrix0.V[1],matrix1.V[2])));
  SideDir:=vectorcrossproduct(FrontDir,matrix1.V[2]);
  NewtonUserJointAddAngularRow(Joint, CalculateAngle(matrix0.V[1], FrontDir,SideDir), @SideDir.V[0]);
  NewtonUserJointSetRowStiffness(Joint, Stiffness);


  // the joint angle can be determined by getting the angle between any two non parallel vectors
  CalculateAngleVar(matrix1.V[0], matrix0.V[0], matrix1.V[1], SinAngle, CosAngle);
  AngularTool.UpdateAngleCosSin(CosAngle, SinAngle);

  CalculateAngleVar(matrix1.V[0], matrix0.V[0], matrix1.V[2], SinAngle, CosAngle);
  AngularTool2nd.UpdateAngleCosSin(CosAngle, SinAngle);         


Then the 3rd dof is the intrinsic rotation of the simple-hinge.
Last edited by blackbird_dream on Thu Oct 26, 2023 8:21 am, edited 1 time in total.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: Ball&Socket unit for v3.14

Postby blackbird_dream » Wed Oct 25, 2023 5:29 am

User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 57 guests