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;
}
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;
}
}
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());
}
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
}
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);
}
Aggregations