Search in sources :

Example 31 with Point

use of artisynth.core.mechmodels.Point 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 32 with Point

use of artisynth.core.mechmodels.Point 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 33 with Point

use of artisynth.core.mechmodels.Point 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

Point (artisynth.core.mechmodels.Point)33 Point3d (maspack.matrix.Point3d)9 Frame (artisynth.core.mechmodels.Frame)8 ArrayList (java.util.ArrayList)8 VectorNd (maspack.matrix.VectorNd)8 ContactPoint (artisynth.core.mechmodels.ContactPoint)6 MotionTargetComponent (artisynth.core.mechmodels.MotionTargetComponent)5 Vertex3d (maspack.geometry.Vertex3d)5 PointParticleAttachment (artisynth.core.mechmodels.PointParticleAttachment)4 BVFeatureQuery (maspack.geometry.BVFeatureQuery)4 BVNode (maspack.geometry.BVNode)4 Boundable (maspack.geometry.Boundable)4 Vector3d (maspack.matrix.Vector3d)4 FemNode3d (artisynth.core.femmodels.FemNode3d)3 BVTree (maspack.geometry.BVTree)3 Face (maspack.geometry.Face)3 PolygonalMesh (maspack.geometry.PolygonalMesh)3 RotationMatrix3d (maspack.matrix.RotationMatrix3d)3 Vector2d (maspack.matrix.Vector2d)3 FemElement3d (artisynth.core.femmodels.FemElement3d)2