Search in sources :

Example 11 with Frame

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

the class FemModel3d method setFrameRelative.

public void setFrameRelative(boolean enable) {
    if (myFrameRelativeP != enable) {
        myFrameRelativeP = enable;
        Frame frame = enable ? myFrame : null;
        for (int i = 0; i < myNodes.size(); i++) {
            myNodes.get(i).setFrame(frame);
        }
        notifyStructureChanged(this);
    }
}
Also used : Frame(artisynth.core.mechmodels.Frame) Point(artisynth.core.mechmodels.Point)

Example 12 with Frame

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

the class PointSkinAttachment method postscanItem.

protected boolean postscanItem(Deque<ScanToken> tokens, CompositeComponent ancestor) throws IOException {
    if (postscanAttributeName(tokens, "connections")) {
        for (int i = 0; i < myNumConnections; i++) {
            Connection c = myConnections[i];
            if (c instanceof FrameConnection) {
                Frame frame = postscanReference(tokens, Frame.class, ancestor);
                ((FrameConnection) c).myFrameInfo = mySkinMesh.getFrameInfo(frame);
            } else if (c instanceof ParticleConnection) {
                ((ParticleConnection) c).myParticle = postscanReference(tokens, Particle.class, ancestor);
            } else if (c instanceof FemDisplacementConnection) {
                ((FemDisplacementConnection) c).myNode = postscanReference(tokens, FemNode3d.class, ancestor);
            }
        }
        return true;
    }
    return super.postscanItem(tokens, ancestor);
}
Also used : Frame(artisynth.core.mechmodels.Frame) Point(artisynth.core.mechmodels.Point)

Example 13 with Frame

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

the class MotionTargetTerm method updateTargetVelocityVec.

private void updateTargetVelocityVec() {
    if (myTargetVel == null || myTargetVel.size() != myTargetVelSize)
        myTargetVel = new VectorNd(myTargetVelSize);
    double[] buf = myTargetVel.getBuffer();
    int idx = 0;
    for (int i = 0; i < myTargets.size(); i++) {
        MotionTargetComponent target = myTargets.get(i);
        if (target instanceof Point) {
            Vector3d vel = ((Point) target).getVelocity();
            buf[idx++] = vel.x;
            buf[idx++] = vel.y;
            buf[idx++] = vel.z;
        } else if (target instanceof Frame) {
            Twist vel = ((Frame) target).getVelocity();
            buf[idx++] = vel.v.x;
            buf[idx++] = vel.v.y;
            buf[idx++] = vel.v.z;
            buf[idx++] = vel.w.x;
            buf[idx++] = vel.w.y;
            buf[idx++] = vel.w.z;
        }
    }
}
Also used : Twist(maspack.spatialmotion.Twist) Frame(artisynth.core.mechmodels.Frame) Vector3d(maspack.matrix.Vector3d) VectorNd(maspack.matrix.VectorNd) Point(artisynth.core.mechmodels.Point) MotionTargetComponent(artisynth.core.mechmodels.MotionTargetComponent) Point(artisynth.core.mechmodels.Point)

Example 14 with Frame

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

the class MotionTargetTerm method fixTargetPositions.

private void fixTargetPositions() {
    for (MotionTargetComponent comp : myTargets) {
        if (comp instanceof Point) {
            Point p = (Point) comp;
            p.setPosition(p.getTargetPosition());
            p.setVelocity(p.getTargetVelocity());
        } else if (comp instanceof Frame) {
            Frame f = (Frame) comp;
            f.setVelocity(f.getTargetVelocity());
            f.setPose(f.getTargetPose());
        }
    }
}
Also used : Frame(artisynth.core.mechmodels.Frame) Point(artisynth.core.mechmodels.Point) MotionTargetComponent(artisynth.core.mechmodels.MotionTargetComponent)

Example 15 with Frame

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

the class MotionTargetTerm method updateWeightsVector.

private void updateWeightsVector() {
    myTargetWgts = new VectorNd(myTargetVelSize);
    int idx = 0;
    for (int t = 0; t < mySources.size(); t++) {
        MotionTargetComponent target = mySources.get(t);
        double w = myTargetWeights.get(t);
        if (target instanceof Point) {
            for (int i = 0; i < POINT_VEL_SIZE; i++) {
                myTargetWgts.set(idx++, w);
            }
        } else if (target instanceof Frame) {
            for (int i = 0; i < FRAME_VEL_SIZE; i++) {
                myTargetWgts.set(idx++, w);
            }
        }
    }
}
Also used : Frame(artisynth.core.mechmodels.Frame) VectorNd(maspack.matrix.VectorNd) Point(artisynth.core.mechmodels.Point) MotionTargetComponent(artisynth.core.mechmodels.MotionTargetComponent) Point(artisynth.core.mechmodels.Point)

Aggregations

Frame (artisynth.core.mechmodels.Frame)15 Point (artisynth.core.mechmodels.Point)12 MotionTargetComponent (artisynth.core.mechmodels.MotionTargetComponent)5 VectorNd (maspack.matrix.VectorNd)3 ModelComponent (artisynth.core.modelbase.ModelComponent)2 WayPoint (artisynth.core.probes.WayPoint)2 PolygonalMesh (maspack.geometry.PolygonalMesh)2 RigidTransform3d (maspack.matrix.RigidTransform3d)2 Vector3d (maspack.matrix.Vector3d)2 Twist (maspack.spatialmotion.Twist)2 ContactPoint (artisynth.core.mechmodels.ContactPoint)1 FrameMarker (artisynth.core.mechmodels.FrameMarker)1 MechModel (artisynth.core.mechmodels.MechModel)1 RevoluteJoint (artisynth.core.mechmodels.RevoluteJoint)1 RigidBody (artisynth.core.mechmodels.RigidBody)1 HasCoordinateFrame (artisynth.core.modelbase.HasCoordinateFrame)1 OrientedTransformableGeometry (artisynth.core.modelbase.OrientedTransformableGeometry)1 TransformableGeometry (artisynth.core.modelbase.TransformableGeometry)1 NumericInputProbe (artisynth.core.probes.NumericInputProbe)1 NumericOutputProbe (artisynth.core.probes.NumericOutputProbe)1