use of maspack.matrix.MatrixNd in project artisynth_core by artisynth.
the class MechSystemSolver method preRotate.
private MatrixNd preRotate(MatrixNd M1, RotationMatrix3d[] R) {
int nbr = R.length;
MatrixNd MR = new MatrixNd(M1.rowSize(), M1.colSize());
Vector3d v3 = new Vector3d();
for (int bi = 0; bi < nbr; bi++) {
for (int j = 0; j < M1.colSize(); j++) {
v3.x = M1.get(bi * 3 + 0, j);
v3.y = M1.get(bi * 3 + 1, j);
v3.z = M1.get(bi * 3 + 2, j);
v3.transform(R[bi]);
MR.set(bi * 3 + 0, j, v3.x);
MR.set(bi * 3 + 1, j, v3.y);
MR.set(bi * 3 + 2, j, v3.z);
}
}
return MR;
}
use of maspack.matrix.MatrixNd in project artisynth_core by artisynth.
the class MechSystemSolver method fullRotate.
private MatrixNd fullRotate(MatrixNd M1, RotationMatrix3d[] R) {
int nbr = R.length;
MatrixNd MT = new MatrixNd(M1.rowSize(), M1.colSize());
MatrixNd MR = new MatrixNd(M1.rowSize(), M1.colSize());
Vector3d v3 = new Vector3d();
for (int bi = 0; bi < nbr; bi++) {
for (int j = 0; j < M1.colSize(); j++) {
v3.x = M1.get(bi * 3 + 0, j);
v3.y = M1.get(bi * 3 + 1, j);
v3.z = M1.get(bi * 3 + 2, j);
v3.transform(R[bi]);
MT.set(bi * 3 + 0, j, v3.x);
MT.set(bi * 3 + 1, j, v3.y);
MT.set(bi * 3 + 2, j, v3.z);
}
}
for (int bj = 0; bj < nbr; bj++) {
for (int i = 0; i < M1.rowSize(); i++) {
v3.x = MT.get(i, bj * 3 + 0);
v3.y = MT.get(i, bj * 3 + 1);
v3.z = MT.get(i, bj * 3 + 2);
v3.transform(R[bj]);
MR.set(i, bj * 3 + 0, v3.x);
MR.set(i, bj * 3 + 1, v3.y);
MR.set(i, bj * 3 + 2, v3.z);
}
}
return MR;
}
use of maspack.matrix.MatrixNd in project artisynth_core by artisynth.
the class MechSystemSolver method buildA.
private MatrixNd buildA(SparseBlockMatrix S, int sizeS, SparseBlockMatrix GT, int sizeG) {
MatrixNd A = new MatrixNd(sizeS + sizeG, sizeS + sizeG);
for (int i = 0; i < sizeS; i++) {
for (int j = 0; j < sizeS; j++) {
A.set(i, j, S.get(i, j));
}
for (int j = 0; j < sizeG; j++) {
A.set(i, j + sizeS, GT.get(i, j));
A.set(j + sizeS, i, GT.get(i, j));
}
}
return A;
}
use of maspack.matrix.MatrixNd in project artisynth_core by artisynth.
the class MechSystemBase method printActiveStiffness.
public void printActiveStiffness() throws IOException {
MatrixNd K = new MatrixNd(getActiveStiffness());
System.out.println("K=\n" + K.toString("%8.3f"));
}
use of maspack.matrix.MatrixNd in project artisynth_core by artisynth.
the class GMLSShapeFunction method computeDM.
@Override
public void computeDM(MatrixNd DM, int dIdx, Point3d pnt, MFreeNode3d[] nodes) {
MatrixNd cc = new MatrixNd(nBasis, nBasis);
DM.setSize(nBasis, nBasis);
DM.setZero();
int[] derivatives = new int[3];
derivatives[dIdx] = 1;
for (MFreeNode3d node : nodes) {
Point3d pos = node.getRestPosition();
double w = node.getWeightFunction().evalDerivative(pnt, derivatives);
for (int i = 0; i <= myOrder; i++) {
for (int j = 0; j <= myOrder - i; j++) {
for (int k = 0; k <= myOrder - i - j; k++) {
// account for symmetries
double d = dcoeff(i, j, k);
computeDPCorrelation(cc, pos.x, pos.y, pos.z, i, j, k);
DM.scaledAdd(d * w, cc);
}
}
}
}
}
Aggregations