Search in sources :

Example 31 with PointParticleAttachment

use of artisynth.core.mechmodels.PointParticleAttachment in project artisynth_core by artisynth.

the class MFreeMeshComp method writeVertexInfo.

private void writeVertexInfo(PrintWriter pw, Vertex3d vtx, NumberFormat fmt) {
    PointAttachment pa = null;
    if (vtx.getIndex() < myVertexAttachments.size()) {
        pa = getAttachment(vtx.getIndex());
    }
    if (pa instanceof PointFem3dAttachment) {
        PointFem3dAttachment pfa = (PointFem3dAttachment) pa;
        FemNode[] masters = pfa.getNodes();
        pw.print("v");
        for (int j = 0; j < masters.length; j++) {
            pw.print(" " + masters[j].getNumber() + " " + fmt.format(pfa.getCoordinate(j)));
        }
        pw.println("");
    } else if (pa instanceof PointParticleAttachment) {
        PointParticleAttachment ppa = (PointParticleAttachment) pa;
        MFreeNode3d n = (MFreeNode3d) ppa.getParticle();
        pw.println("v " + n.getNumber() + " 1.0");
    } else {
        pw.println("v -1 " + vtx.getPosition().toString(fmt));
    }
}
Also used : FemNode(artisynth.core.femmodels.FemNode) PointFem3dAttachment(artisynth.core.femmodels.PointFem3dAttachment) PointAttachment(artisynth.core.mechmodels.PointAttachment) PointParticleAttachment(artisynth.core.mechmodels.PointParticleAttachment) ContactPoint(artisynth.core.mechmodels.ContactPoint) Point(artisynth.core.mechmodels.Point)

Aggregations

PointParticleAttachment (artisynth.core.mechmodels.PointParticleAttachment)31 ContactPoint (artisynth.core.mechmodels.ContactPoint)21 Point (artisynth.core.mechmodels.Point)21 PointAttachment (artisynth.core.mechmodels.PointAttachment)16 Vertex3d (maspack.geometry.Vertex3d)15 PointFem3dAttachment (artisynth.core.femmodels.PointFem3dAttachment)13 ArrayList (java.util.ArrayList)12 VectorNd (maspack.matrix.VectorNd)11 FemNode (artisynth.core.femmodels.FemNode)10 PolygonalMesh (maspack.geometry.PolygonalMesh)10 Point3d (maspack.matrix.Point3d)9 Face (maspack.geometry.Face)5 IOException (java.io.IOException)4 HashMap (java.util.HashMap)3 FemNode3d (artisynth.core.femmodels.FemNode3d)2 ContactMaster (artisynth.core.mechmodels.ContactMaster)2 ObjectToken (artisynth.core.util.ObjectToken)2 BVFeatureQuery (maspack.geometry.BVFeatureQuery)2 HalfEdge (maspack.geometry.HalfEdge)2 MeshBase (maspack.geometry.MeshBase)2