Search in sources :

Example 6 with Plane

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

the class EditingAgent method intersectViewPlane.

/**
 * Intersect a ray with a view plane defined by the current eye direction and
 * a reference point.
 */
public Point3d intersectViewPlane(Line ray, Point3d ref, GLViewer viewer) {
    Point3d res = new Point3d();
    RotationMatrix3d R = viewer.getCenterToWorld().R;
    Plane plane = new Plane(new Vector3d(R.m02, R.m12, R.m22), ref);
    plane.intersectRay(res, ray.getDirection(), ray.getOrigin());
    return res;
}
Also used : Plane(maspack.matrix.Plane) GLClipPlane(maspack.render.GL.GLClipPlane) Vector3d(maspack.matrix.Vector3d) Point3d(maspack.matrix.Point3d) RotationMatrix3d(maspack.matrix.RotationMatrix3d)

Example 7 with Plane

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

the class EditingAgent method intersectClipPlane.

/**
 * Intersects a ray with a viewer clip plane and returns the corresponding
 * point. If there is no intersection because the plane is perpendicular to
 * the eye direction, then null is returned.
 */
public Point3d intersectClipPlane(Line ray, GLClipPlane clipPlane) {
    Point3d res = new Point3d();
    Plane plane = new Plane();
    clipPlane.getPlane(plane);
    if (ray.intersectPlane(res, plane) == Double.POSITIVE_INFINITY) {
        return null;
    } else {
        return res;
    }
}
Also used : Plane(maspack.matrix.Plane) GLClipPlane(maspack.render.GL.GLClipPlane) Point3d(maspack.matrix.Point3d)

Example 8 with Plane

use of maspack.matrix.Plane 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 9 with Plane

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

the class SoftPlaneCollider method transformGeometry.

public void transformGeometry(GeometryTransformer gtr, TransformGeometryContext context, int flags) {
    Plane plane = new Plane(myNormal, myCenter.dot(myNormal));
    gtr.transform(plane, myCenter);
    myNormal.set(plane.getNormal());
    gtr.transformPnt(myCenter);
// should also update size, based on uniform scaling
}
Also used : Plane(maspack.matrix.Plane)

Example 10 with Plane

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

the class ParticlePlaneConstraint method transformGeometry.

public void transformGeometry(GeometryTransformer gtr, TransformGeometryContext context, int flags) {
    // particles was transformed, hence invoking a call to this method.
    if (!context.contains(this)) {
        return;
    }
    Plane plane = new Plane(myNrm, myOff);
    gtr.transformPnt(myCenter);
    gtr.transform(plane, myCenter);
    myNrm.set(plane.normal);
    myOff = myNrm.dot(myCenter);
}
Also used : Plane(maspack.matrix.Plane)

Aggregations

Plane (maspack.matrix.Plane)19 Point3d (maspack.matrix.Point3d)11 Vector3d (maspack.matrix.Vector3d)10 TetDesc (maspack.geometry.DistanceGrid.TetDesc)3 RigidTransform3d (maspack.matrix.RigidTransform3d)3 ArrayList (java.util.ArrayList)2 RotationMatrix3d (maspack.matrix.RotationMatrix3d)2 GLClipPlane (maspack.render.GL.GLClipPlane)2 RenderProps (maspack.render.RenderProps)2 FemElement3d (artisynth.core.femmodels.FemElement3d)1 FemMeshComp (artisynth.core.femmodels.FemMeshComp)1 FemMuscleModel (artisynth.core.femmodels.FemMuscleModel)1 MuscleBundle (artisynth.core.femmodels.MuscleBundle)1 FemMaterial (artisynth.core.materials.FemMaterial)1 LinearMaterial (artisynth.core.materials.LinearMaterial)1 MuscleMaterial (artisynth.core.materials.MuscleMaterial)1 SimpleForceMuscle (artisynth.core.materials.SimpleForceMuscle)1 MechModel (artisynth.core.mechmodels.MechModel)1 RigidBody (artisynth.core.mechmodels.RigidBody)1 Color (java.awt.Color)1