Search in sources :

Example 6 with Matrix3x3Block

use of maspack.matrix.Matrix3x3Block in project artisynth_core by artisynth.

the class LinearPointConstraint method setPoints.

/**
 * Initializes the constraint with a set of points and weights.  All
 * {@code Point} objects should be unique.
 * @param pnts list of points to constrain
 * @param wgts set of weights
 */
public void setPoints(Point[] pnts, double[] wgts) {
    myPoints = Arrays.copyOf(pnts, pnts.length);
    // 3 constraints (x, y, z)
    myLam = new double[3];
    myWgts = Arrays.copyOf(wgts, wgts.length);
    myBlks = new Matrix3x3Block[myPoints.length];
    for (int i = 0; i < myPoints.length; i++) {
        myBlks[i] = new Matrix3x3Block();
        myBlks[i].m00 = myWgts[i];
        myBlks[i].m11 = myWgts[i];
        myBlks[i].m22 = myWgts[i];
    }
}
Also used : Matrix3x3Block(maspack.matrix.Matrix3x3Block)

Example 7 with Matrix3x3Block

use of maspack.matrix.Matrix3x3Block in project artisynth_core by artisynth.

the class FemModel3d method addPosJacobian.

public void addPosJacobian(SparseNumberedBlockMatrix M, double s) {
    if (!myStressesValidP || !myStiffnessesValidP) {
        updateStressAndStiffness();
    }
    for (int i = 0; i < myNodes.size(); i++) {
        FemNode3d node = myNodes.get(i);
        if (node.getSolveIndex() != -1) {
            for (FemNodeNeighbor nbr : getNodeNeighbors(node)) {
                if (nbr.myNode.getSolveIndex() != -1) {
                    Matrix3x3Block blk = (Matrix3x3Block) M.getBlockByNumber(nbr.myBlkNum);
                    nbr.addPosJacobian(blk, s);
                }
            }
            // used for soft nodal-based incompressibilty:
            for (FemNodeNeighbor nbr : getIndirectNeighbors(node)) {
                if (nbr.myNode.getSolveIndex() != -1) {
                    Matrix3x3Block blk = (Matrix3x3Block) M.getBlockByNumber(nbr.myBlkNum);
                    nbr.addPosJacobian(blk, s);
                }
            }
        }
    }
// System.out.println ("symmetric=" + mySolveMatrix.isSymmetric(1e-6));
}
Also used : Matrix3x3Block(maspack.matrix.Matrix3x3Block) Point(artisynth.core.mechmodels.Point)

Example 8 with Matrix3x3Block

use of maspack.matrix.Matrix3x3Block in project artisynth_core by artisynth.

the class PointFem3dAttachment method updateMasterBlocks.

@Override
protected int updateMasterBlocks() {
    int idx = super.updateMasterBlocks();
    RotationMatrix3d R1 = null;
    RotationMatrix3d R2 = null;
    if (idx == 1) {
        // then the point also has a frame; set R1 to that frame's rotation
        R1 = myPoint.getPointFrame().getPose().R;
    }
    myNoFrameRelativeP = false;
    if (myFemFrame != null) {
        R2 = myFemFrame.getPose().R;
        // local position in FemFrame
        Point3d lpos = new Point3d();
        lpos.inverseTransform(myFemFrame.getPose(), myPoint.getPosition());
        myFemFrame.computeLocalPointForceJacobian(myMasterBlocks[idx++], lpos, R1);
    } else if (R1 == null) {
        myNoFrameRelativeP = true;
    }
    if (!myNoFrameRelativeP) {
        RotationMatrix3d R = new RotationMatrix3d();
        if (R1 != null && R2 != null) {
            R.mulInverseLeft(R2, R1);
        } else if (R1 != null) {
            R.set(R1);
        } else if (R2 != null) {
            R.transpose(R2);
        }
        for (int i = 0; i < myNodes.length; i++) {
            Matrix3x3Block pblk = (Matrix3x3Block) myMasterBlocks[idx++];
            pblk.scale(myCoords.get(i), R);
        }
    } else {
    // no need to update blocks since blocks will not be used
    }
    return idx;
}
Also used : Point3d(maspack.matrix.Point3d) Matrix3x3Block(maspack.matrix.Matrix3x3Block) Point(artisynth.core.mechmodels.Point) RotationMatrix3d(maspack.matrix.RotationMatrix3d)

Example 9 with Matrix3x3Block

use of maspack.matrix.Matrix3x3Block in project artisynth_core by artisynth.

the class Point method addSolveBlock.

public void addSolveBlock(SparseNumberedBlockMatrix S) {
    int bi = getSolveIndex();
    Matrix3x3Block blk = new Matrix3x3Block();
    mySolveBlockNum = S.addBlock(bi, bi, blk);
}
Also used : Matrix3x3Block(maspack.matrix.Matrix3x3Block)

Aggregations

Matrix3x3Block (maspack.matrix.Matrix3x3Block)9 Point (artisynth.core.mechmodels.Point)5 MatrixBlock (maspack.matrix.MatrixBlock)2 Matrix6dBlock (maspack.matrix.Matrix6dBlock)1 Point3d (maspack.matrix.Point3d)1 RotationMatrix3d (maspack.matrix.RotationMatrix3d)1 SparseBlockMatrix (maspack.matrix.SparseBlockMatrix)1 SpatialInertia (maspack.spatialmotion.SpatialInertia)1 Twist (maspack.spatialmotion.Twist)1 Wrench (maspack.spatialmotion.Wrench)1