/** * Gets the direction of this PickCone. * @param direction the Vector3d object into which the direction * will be copied. */ public void getDirection(Vector3d direction) { direction.set(this.direction); }
/** * Gets the direction of this cylinder. * @param direction the Vector3d object into which the direction * will be copied */ public void getDirection(Vector3d direction) { direction.set(this.direction); }
/** * Set the rotation axis to the specified Vector3f. */ public void setRotationAxis(final Vector3f a) { rotationAxis.set(a); }
coexistenceCenter.set(0.0, 0.0, 0.0);
/** * Rotates the view around the global rotation center by the specified angle * around the y axis (of the image plate). * * @param angle The angle (in rad) around the y-axis */ public void rotateY(final double angle) { yDir.set(0, 1, 0); rotate(yDir, angle); }
/** * Rotates the view around the global rotation center by the specified angle * around the x axis (of the image plate). * * @param angle The angle (in rad) around the x-axis */ public void rotateX(final double angle) { xDir.set(1, 0, 0); rotate(xDir, angle); }
/** * Rotates the view around the global rotation center by the specified angle * around the z axis (of the image plate). * * @param angle The angle (in rad) around the z-axis */ public void rotateZ(final double angle) { zDir.set(0, 0, 1); rotate(zDir, angle); }
/** * Sets the parameters of this PickCylinderRay to the specified values. * @param origin the origin of the cylindrical ray. * @param direction the direction of the cylindrical ray. * @param radius the radius of the cylindrical ray. */ public void set(Point3d origin, Vector3d direction, double radius) { this.origin.set(origin); this.direction.set(direction); this.radius = radius; }
/** * Sets the parameters of this PickCone to the specified values. * @param origin the origin of the cone * @param direction the direction of the cone * @param spreadAngle the spread angle of the cone in radians */ public void set(Point3d origin, Vector3d direction, double spreadAngle) { this.origin.set(origin); this.direction.set(direction); this.spreadAngle = spreadAngle; }
private void updateRotationAxisAndCenter() { v1.set(0, 1, 0); v2.cross(v1, rotationAxis); final double angle = Math.acos(v1.dot(rotationAxis)); aa.set(v2, angle); centerXform.set(aa); } }
/** * Computes the new transform for this interpolator for a given * alpha value. * * @param alphaValue alpha value between 0.0 and 1.0 * @param transform object that receives the computed transform for * the specified alpha value * * @since Java 3D 1.3 */ @Override public void computeTransform(float alphaValue, Transform3D transform) { double val = (1.0-alphaValue)*startPosition + alphaValue*endPosition; // construct a Transform3D from: axis * translation * axisInverse transv.set(val, 0.0, 0.0); translation.setTranslation(transv); transform.mul(axis, translation); transform.mul(transform, axisInverse); }
static boolean edgeIntersectPlane(Vector3d normal, Point3d pnt, Point3d start, Point3d end, Point3d iPnt){ Vector3d tempV3d = new Vector3d(); Vector3d direction = new Vector3d(); double pD, pNrmDotrDir, tr; // Compute plane D. tempV3d.set((Tuple3d) pnt); pD = normal.dot(tempV3d); direction.x = end.x - start.x; direction.y = end.y - start.y; direction.z = end.z - start.z; pNrmDotrDir = normal.dot(direction); // edge is parallel to plane. if (pNrmDotrDir== 0.0) { // System.out.println("Edge is parallel to plane."); return false; } tempV3d.set((Tuple3d) start); tr = (pD - normal.dot(tempV3d))/ pNrmDotrDir; // Edge intersects the plane behind the edge's start. // or exceed the edge's length. if ((tr < 0.0 ) || (tr > 1.0 )) { // System.out.println("Edge intersects the plane behind the start or exceed end."); return false; } iPnt.x = start.x + tr * direction.x; iPnt.y = start.y + tr * direction.y; iPnt.z = start.z + tr * direction.z; return true; }
private void setEyeScreenRelative(CanvasInfo ci, Point3d leftEye, Point3d rightEye) { if (ci.useStereo) { ci.eyeInPlate.set(leftEye) ; ci.rightEyeInPlate.set(rightEye) ; if (ci.rightEyeToPlate == null) ci.rightEyeToPlate = new Transform3D() ; v3d.set(ci.rightEyeInPlate) ; ci.rightEyeToPlate.set(v3d) ; } else { switch (ci.monoscopicPolicy) { case View.CYCLOPEAN_EYE_VIEW: ci.eyeInPlate.set((leftEye.x + rightEye.x) / 2.0, (leftEye.y + rightEye.y) / 2.0, (leftEye.z + rightEye.z) / 2.0) ; break ; case View.LEFT_EYE_VIEW: ci.eyeInPlate.set(leftEye) ; break ; case View.RIGHT_EYE_VIEW: ci.eyeInPlate.set(rightEye) ; break ; } } v3d.set(ci.eyeInPlate) ; ci.eyeToPlate.set(v3d) ; }
/** * Sets the center around which the View rotates. * The default is (0,0,0). * @param center The Point3d to set the center of rotation to */ public synchronized void setRotationCenter(Point3d center) { Point3d centerDelta = new Point3d(); centerDelta.sub(centerVector, center); Transform3D invRot = new Transform3D(rotateTransform); invRot.invert(); invRot.transform(centerDelta); xtrans += centerDelta.x; ytrans += centerDelta.y; ztrans += centerDelta.z; rotationCenter.x = center.x; rotationCenter.y = center.y; rotationCenter.z = center.z; centerVector.set(rotationCenter); }
if (pickShapeDir == null) pickShapeDir = new Vector3d(); ((PickSegment)pickShape).get(pickShapeStart, pickShapeEnd); pickShapeDir.set (pickShapeEnd.x - pickShapeStart.x, pickShapeEnd.y - pickShapeStart.y, pickShapeEnd.z - pickShapeStart.z);
/** * Center the view at the given point. * * @param center */ public void centerAt(final Point3d center) { // set the center transformation to the translation given by // the specified point centerV.set(center.x, center.y, center.z); centerXform.set(centerV); centerTG.setTransform(centerXform); // set the global translation to identity centerXform.setIdentity(); translateTG.setTransform(centerXform); transformChanged(BehaviorCallback.TRANSLATE, centerXform); // update rotation center rotCenter.set(center); }
/** * Moves the view back (i.e. in the z-direction of the image plate) to the * specified distance. * * @param distance */ public void zoomTo(final double distance) { zDir.set(0, 0, 1); zDir.scale(distance); zoomXform.set(zDir); zoomTG.setTransform(zoomXform); univ.getViewer().getView().setBackClipDistance(5 * distance); univ.getViewer().getView().setFrontClipDistance(5 * distance / 100); transformChanged(BehaviorCallback.TRANSLATE, zoomXform); }
final float dx = (float) originOnIp.distance(currentPtOnIp); zDir.set(0, 0, -1); final float factor = dx * dD / dd; zDir.scale(units * factor);