Search in sources :

Example 41 with RigidTransform3d

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

the class LineSegment method getPlaneValues.

public int getPlaneValues(float[] vals, int offset) {
    RigidTransform3d X = XGridToWorld;
    vals[offset++] = (float) (-X.R.m02);
    vals[offset++] = (float) (-X.R.m12);
    vals[offset++] = (float) (-X.R.m22);
    vals[offset++] = (float) (X.R.m02 * X.p.x + X.R.m12 * X.p.y + X.R.m22 * X.p.z);
    return offset;
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d)

Example 42 with RigidTransform3d

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

the class LineSegment method getPlane.

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)

Example 43 with RigidTransform3d

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

the class LineSegment method setOrientation.

public void setOrientation(AxisAngle axisAng) {
    RigidTransform3d X = new RigidTransform3d(XGridToWorld);
    X.R.setAxisAngle(axisAng);
    setGridToWorld(X);
    System.out.println();
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d)

Example 44 with RigidTransform3d

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

the class MouseRayEvent method create.

public static MouseRayEvent create(MouseEvent e, GLViewer viewer) {
    MouseRayEvent de = new MouseRayEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiersEx(), e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger());
    de.myScreenWidth = viewer.getScreenWidth();
    de.myScreenHeight = viewer.getScreenHeight();
    double vph = viewer.getViewPlaneHeight();
    double vpw = viewer.getViewPlaneWidth();
    de.myViewPlaneHeight = vph;
    de.myViewPlaneWidth = vpw;
    de.myViewPlaneDistance = viewer.getViewPlaneDistance();
    // vx and vy give the current cursor location in the viewplane
    double vx = vpw * (-0.5 + de.getX() / (double) de.myScreenWidth);
    double vy = vph * (0.5 - de.getY() / (double) de.myScreenHeight);
    if (viewer.isOrthogonal()) {
        de.myRay = new Line(vx, vy, de.myViewPlaneDistance, 0, 0, -1);
    } else {
        de.myRay = new Line(0, 0, 0, vx, vy, -de.myViewPlaneDistance);
    }
    RigidTransform3d XWorldToBase = new RigidTransform3d();
    viewer.getViewMatrix(XWorldToBase);
    de.myRay.inverseTransform(XWorldToBase);
    de.myViewer = viewer;
    return de;
}
Also used : Line(maspack.matrix.Line) RigidTransform3d(maspack.matrix.RigidTransform3d)

Example 45 with RigidTransform3d

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

the class Rotator3d method render.

public void render(Renderer renderer, int flags) {
    if (!myVisibleP) {
        return;
    }
    renderer.pushModelMatrix();
    renderer.mulModelMatrix(myXDraggerToWorld);
    Shading savedShading = renderer.setShading(Shading.NONE);
    renderer.setLineWidth(myLineWidth);
    renderer.scaleModelMatrix(mySize);
    if (renderObject == null || !renderObject.isValid()) {
        renderObject = createRotatorRenderable();
    }
    // highlight appropriate axis
    if (mySelectedComponent != 0) {
        renderer.drawLines(renderObject, mySelectedComponent);
    }
    renderer.drawLines(renderObject, 0);
    renderer.popModelMatrix();
    if (myDragMode != DragMode.OFF) {
        switch(mySelectedComponent) {
            case X_AXIS:
            case Y_AXIS:
            case Z_AXIS:
                {
                    final float[] coords0 = new float[] { 0, 0, 0 };
                    float[] coords = new float[3];
                    // Draw rotation lines using the orientation at the time the drag was
                    // started
                    RigidTransform3d X = new RigidTransform3d(myXDraggerToWorld0);
                    X.p.set(myXDraggerToWorld.p);
                    renderer.pushModelMatrix();
                    renderer.mulModelMatrix(X);
                    renderer.setColor(0.5f, 0.5f, 0.5f);
                    myPnt0.get(coords);
                    renderer.drawLine(coords0, coords);
                    renderer.setColor(1, 1, 0);
                    myRotPnt.get(coords);
                    renderer.drawLine(coords0, coords);
                    renderer.popModelMatrix();
                    break;
                }
        }
    }
    renderer.setLineWidth(1);
    renderer.setShading(savedShading);
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d) Shading(maspack.render.Renderer.Shading)

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