use of artisynth.core.mechmodels.SlottedRevoluteJoint in project artisynth_core by artisynth.
the class JointedFemBeams method build.
public void build(String[] args) {
MechModel mech = new MechModel("mechMod");
addModel(mech);
double stiffness = 5000;
// create first fem beam and fix the leftmost nodes
FemModel3d fem1 = addFem(mech, 2.4, 0.6, 0.4, stiffness);
for (FemNode3d n : fem1.getNodes()) {
if (n.getPosition().x <= -1.2) {
n.setDynamic(false);
}
}
// create the second fem beam and shift it 1.5 to the right
FemModel3d fem2 = addFem(mech, 2.4, 0.4, 0.4, 0.1 * stiffness);
fem2.transformGeometry(new RigidTransform3d(1.5, 0, 0));
// create a slotted revolute joint that connects the two fem beams
RigidTransform3d TDW = new RigidTransform3d(0.5, 0, 0, 0, 0, Math.PI / 2);
SlottedRevoluteJoint joint = new SlottedRevoluteJoint(fem2, fem1, TDW);
mech.addBodyConnector(joint);
// set ranges and rendering properties for the joint
joint.setAxisLength(0.8);
joint.setMinX(-0.5);
joint.setMaxX(0.5);
joint.setSlotWidth(0.61);
RenderProps.setLineColor(joint, myJointColor);
RenderProps.setLineWidth(joint, 3);
RenderProps.setLineRadius(joint, 0.04);
}
Aggregations