Search in sources :

Example 1 with SphericalJointBase

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);
    }
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d) SphericalJointBase(artisynth.core.mechmodels.SphericalJointBase) PlanarConnector(artisynth.core.mechmodels.PlanarConnector)

Example 2 with SphericalJointBase

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++;
}
Also used : Matrix3x3DiagBlock(maspack.matrix.Matrix3x3DiagBlock) MatrixBlock(maspack.matrix.MatrixBlock) SphericalJointBase(artisynth.core.mechmodels.SphericalJointBase) PlanarConnector(artisynth.core.mechmodels.PlanarConnector) Matrix1x1Block(maspack.matrix.Matrix1x1Block)

Aggregations

PlanarConnector (artisynth.core.mechmodels.PlanarConnector)2 SphericalJointBase (artisynth.core.mechmodels.SphericalJointBase)2 Matrix1x1Block (maspack.matrix.Matrix1x1Block)1 Matrix3x3DiagBlock (maspack.matrix.Matrix3x3DiagBlock)1 MatrixBlock (maspack.matrix.MatrixBlock)1 RigidTransform3d (maspack.matrix.RigidTransform3d)1