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