use of artisynth.core.mechmodels.SphericalJointBase in project artisynth_core by artisynth.
the class ForceTarget method prerender.
@Override
public void prerender(RenderList list) {
super.prerender(list);
if (myConnector instanceof PlanarConnector) {
RigidTransform3d TDW = myConnector.getCurrentTDW();
startvec = TDW.p;
endvec.transform(TDW, Vector3d.Z_UNIT);
endvec.scale(arrowSize / endvec.norm());
endvec.scale(myTargetLambda.get(0));
endvec.add(startvec);
set(start, startvec);
set(end, endvec);
} else if (myConnector instanceof SphericalJointBase) {
startvec = myConnector.getCurrentTCW().p;
endvec.x = myTargetLambda.get(0) * arrowSize;
endvec.y = myTargetLambda.get(1) * arrowSize;
endvec.z = myTargetLambda.get(2) * arrowSize;
endvec.add(startvec);
set(start, startvec);
set(end, endvec);
}
}
use of artisynth.core.mechmodels.SphericalJointBase in project artisynth_core by artisynth.
the class ForceTarget method addForceJacobian.
public int addForceJacobian(SparseBlockMatrix J, int bi, int solve_index) {
MatrixBlock blk = null;
if (myConnector instanceof PlanarConnector) {
blk = new Matrix1x1Block();
blk.set(0, 0, 1d);
J.addBlock(bi, solve_index, blk);
} else if (myConnector instanceof SphericalJointBase) {
blk = new Matrix3x3DiagBlock(1d, 1d, 1d);
J.addBlock(bi, solve_index, blk);
} else {
System.err.println("ForceTarget.addForceJacobian: unsupported connector type: " + myConnector.getClass());
}
return bi++;
}
Aggregations