Search in sources :

Example 71 with RigidTransform3d

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

the class RevoluteJoint method getTheta.

public double getTheta() {
    // RigidTransform3d XAW = myBodyA.getPose();
    // RigidTransform3d XBW =
    // myBodyB != null ? myBodyB.getPose() : RigidTransform3d.IDENTITY;
    // 
    // // initialize TGD to TCD; it will get projected to TGD within
    // // myCoupling.getTheta();
    // RigidTransform3d TCA = new RigidTransform3d();
    // RigidTransform3d TGD = new RigidTransform3d();
    // getCurrentTCA (TCA);
    // getCurrentTDB (TGD);
    // TGD.mulInverseBoth (TGD, XBW);
    // TGD.mul (XAW);
    // TGD.mul (TCA);
    // initialize TGD to TCD; it will get projected to TGD within
    // myCoupling.getTheta();
    RigidTransform3d TGD = new RigidTransform3d();
    getCurrentTCD(TGD);
    double theta = Math.toDegrees(((RevoluteCoupling) myCoupling).getTheta(TGD));
    return theta;
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d)

Example 72 with RigidTransform3d

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

the class SegmentedPlanarConnector method doset.

// private void makePlanesFromSegments (
// RigidTransform3d XPB, ArrayList<Point3d> segPoints)
// {
// myPlanes = new ArrayList<Plane>();
// // now create the planes
// Vector3d u = new Vector3d();
// Vector3d nrm = new Vector3d();
// Vector3d y = new Vector3d (XPB.R.m01, XPB.R.m11, XPB.R.m21);
// for (int i=1; i<segPoints.size(); i++)
// { u.sub (segPoints.get(i), segPoints.get(i-1));
// nrm.cross (u, y);
// nrm.normalize();
// myPlanes.add (new Plane (nrm, nrm.dot(segPoints.get(i))));
// }
// }
// private void makeSegmentPoints (
// RigidTransform3d XPB, double[] segs)
// {
// myPoints = new ArrayList<Point3d>();
// // make private copy of the points
// for (int i=0; i<segs.length; i+=2)
// { Point3d pnt = new Point3d(segs[i], 0.0, segs[i+1]);
// pnt.transform (XPB);
// myPoints.add (pnt);
// }
// }
private void doset(RigidBody bodyA, Vector3d pCA, RigidBody bodyB, RigidTransform3d XDB, double[] segs) {
    RigidTransform3d TCA = new RigidTransform3d();
    TCA.p.set(pCA);
    setBodies(bodyA, TCA, bodyB, XDB);
    mySegPlaneCoupling.setSegments(segs);
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d)

Example 73 with RigidTransform3d

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

the class SegmentedPlanarConnector method render.

public void render(Renderer renderer, int flags) {
    Vector3d nrm = new Vector3d(0, 0, 1);
    RigidTransform3d TDW = getCurrentTDW();
    RenderProps props = myRenderProps;
    Shading savedShading = renderer.setPropsShading(props);
    renderer.setFaceColoring(props, isSelected());
    renderer.setFaceStyle(props.getFaceStyle());
    ArrayList<Plane> planes = mySegPlaneCoupling.getPlanes();
    for (int i = 0; i < planes.size(); i++) {
        Plane plane = planes.get(i);
        nrm.set(plane.getNormal());
        computeRenderVtxs(i, TDW);
        renderer.beginDraw(DrawMode.TRIANGLE_STRIP);
        if (myRenderNormalReversedP) {
            renderer.setNormal(-nrm.x, -nrm.y, -nrm.z);
        } else {
            renderer.setNormal(nrm.x, nrm.y, nrm.z);
        }
        renderer.addVertex(myRenderVtxs[3]);
        renderer.addVertex(myRenderVtxs[0]);
        renderer.addVertex(myRenderVtxs[2]);
        renderer.addVertex(myRenderVtxs[1]);
        renderer.endDraw();
    }
    renderer.setShading(savedShading);
    renderer.setFaceStyle(FaceStyle.FRONT);
    renderer.drawPoint(myRenderProps, myRenderCoords, isSelected());
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d) Vector3d(maspack.matrix.Vector3d) Plane(maspack.matrix.Plane) RenderProps(maspack.render.RenderProps) Shading(maspack.render.Renderer.Shading)

Example 74 with RigidTransform3d

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

the class PlanarConnector method set.

/**
 * Sets this PlanarConnectorX to connect a rigid body with the world frame.
 * The contact point is fixed in the body frame, while the plane is fixed in
 * the world frame.
 *
 * @param bodyA
 * rigid body
 * @param pCA
 * location of contact point relative to body
 * @param XPW
 * plane coordinate frame with respect to the world. The plane normal is
 * given by the z axis of this frame, and the plane's origin is given by
 * XPB.p
 */
public void set(RigidBody bodyA, Vector3d pCA, RigidTransform3d XPW) {
    RigidTransform3d TCA = new RigidTransform3d();
    TCA.p.set(pCA);
    setBodies(bodyA, TCA, null, XPW);
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d)

Example 75 with RigidTransform3d

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

the class CutPlaneProbe method getPlane.

/**
 * Gets the plane along which the display lies
 */
public void getPlane(Plane plane) {
    RigidTransform3d X = XGridToWorld;
    plane.set(-X.R.m02, -X.R.m12, -X.R.m22, -X.R.m02 * X.p.x - X.R.m12 * X.p.y - X.R.m22 * X.p.z);
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d)

Aggregations

RigidTransform3d (maspack.matrix.RigidTransform3d)206 Vector3d (maspack.matrix.Vector3d)56 Point3d (maspack.matrix.Point3d)48 PolygonalMesh (maspack.geometry.PolygonalMesh)21 MechModel (artisynth.core.mechmodels.MechModel)19 RigidBody (artisynth.core.mechmodels.RigidBody)18 AxisAngle (maspack.matrix.AxisAngle)18 RotationMatrix3d (maspack.matrix.RotationMatrix3d)17 AffineTransform3d (maspack.matrix.AffineTransform3d)13 FemModel3d (artisynth.core.femmodels.FemModel3d)11 RenderProps (maspack.render.RenderProps)11 FemNode3d (artisynth.core.femmodels.FemNode3d)9 Color (java.awt.Color)7 Point (java.awt.Point)7 Matrix3d (maspack.matrix.Matrix3d)7 Shading (maspack.render.Renderer.Shading)7 LinearMaterial (artisynth.core.materials.LinearMaterial)6 Renderable (maspack.render.Renderable)6 ArrayList (java.util.ArrayList)5 Vector2d (maspack.matrix.Vector2d)5