/** * Retrieves the alignment axis of this OrientedShape3D node, * and copies it into the specified vector. * @param axis the vector that will contain the alignment axis */ void getAlignmentAxis(Vector3f axis) { axis.set(this.axis); }
/** * Copy the current rotation axis into the given Vector3f. */ public void getRotationAxis(final Vector3f ret) { ret.set(rotationAxis); }
public void setDirection(Vector3d direction) { this.direction.set(direction); return; }
/** * Gets the alignment axis and sets the parameter to this value. * @param axis the vector that will contain the ray about which * the billboard rotates */ public void getAlignmentAxis(Vector3f axis) { axis.set(this.axis); }
void getXformDirection(Vector3f direction) { direction.set(this.xformDirection); }
void initAlignmentAxis(float x, float y, float z) { this.axis.set(x,y,z); double invMag; invMag = 1.0/Math.sqrt(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z); nAxis.x = (double)axis.x*invMag; nAxis.y = (double)axis.y*invMag; nAxis.z = (double)axis.z*invMag; }
/** * Sets the alignment axis. * The specified axis must not be parallel to the <i>Z</i> * axis--(0,0,<i>z</i>) for any value of <i>z</i>. It is not * possible for the +<i>Z</i> axis to point at the viewer's eye * position by rotating about itself. The target transform will * be set to the identity if the axis is (0,0,<i>z</i>). * * @param x the x component of the ray about which the billboard rotates * @param y the y component of the ray about which the billboard rotates * @param z the z component of the ray about which the billboard rotates */ public void setAlignmentAxis(float x, float y, float z) { this.axis.set(x, y, z); this.axis.set(axis); double invMag; invMag = 1.0/Math.sqrt(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z); nAxis.x = (double)axis.x*invMag; nAxis.y = (double)axis.y*invMag; nAxis.z = (double)axis.z*invMag; }
/** * Sets the alignment axis. * The specified axis must not be parallel to the <i>Z</i> * axis--(0,0,<i>z</i>) for any value of <i>z</i>. It is not * possible for the +<i>Z</i> axis to point at the viewer's eye * position by rotating about itself. The target transform will * be set to the identity if the axis is (0,0,<i>z</i>). * * @param axis the ray about which the billboard rotates */ public void setAlignmentAxis(Vector3f axis) { this.axis.set(axis); double invMag; invMag = 1.0/Math.sqrt(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z); nAxis.x = (double)axis.x*invMag; nAxis.y = (double)axis.y*invMag; nAxis.z = (double)axis.z*invMag; }
/** * Initializes the spot light's direction from the vector provided. * @param direction the new direction of the light */ void initDirection(Vector3f direction) { this.direction.set(direction); if (staticTransform != null) { staticTransform.transform.transform(this.direction, this.direction); } }
/** * Initializes this light's direction from the vector provided. * @param direction the new direction */ void initDirection(Vector3f direction) { this.direction.set(direction); if (staticTransform != null) { staticTransform.transform.transform( this.direction, this.direction); } }
/** * Retrieves this light's direction and places it in the * vector provided. * @param direction the variable to receive the direction vector */ void getDirection(Vector3f direction) { direction.set(this.direction); if (staticTransform != null) { Transform3D invTransform = staticTransform.getInvTransform(); invTransform.transform(direction, direction); } }
/** * Retrieves this light's direction and places it in the * vector provided. * @param direction the variable to receive the direction vector */ void getDirection(Vector3f direction) { direction.set(this.direction); if (staticTransform != null) { Transform3D invTransform = staticTransform.getInvTransform(); invTransform.transform(direction, direction); } }
/** * Retrieves this sound's direction and places it in the * vector provided. * @return direction vector (axis of cones) */ void getDirection(Vector3f direction) { if (staticTransform != null) { Transform3D invTransform = staticTransform.getInvTransform(); invTransform.transform(this.direction, direction); } else { direction.set(this.direction); } }
void setXformedDirection() { if (debugFlag) debugPrint("*** setXformedDirection"); if (!getVWrldXfrmFlag()) { if (debugFlag) debugPrint(" Transform NOT set yet, so dir => xformDir"); xformDirection.set(direction); } else { if (debugFlag) debugPrint(" Transform dir => xformDir"); vworldXfrm.transform(direction, xformDirection); } if (debugFlag) debugPrint(" xform(sound)Direction <= "+xformDirection.x+ ", " + xformDirection.y + ", " + xformDirection.z); }
/** * Set the current normal that will be copied to each succeeding vertex * output by the decompressor. The per-vertex copy is always needed since * in Java 3D a normal is always associated with a vertex. This is never * called if normals are bundled with each vertex in the compressed * buffer. */ @Override void outputNormal(Vector3f normal) { if (boundsOnly || positionsOnly) return ; if (debug) System.err.println("outputNormal: " + normal.toString()) ; if ((vlist.vertexFormat & GeometryArray.NORMALS) == 0) { if (vlist.size() > 0) throw new IllegalStateException (J3dI18N.getString("GeometryDecompressorRetained3")) ; vlist.setVertexFormat(vlist.vertexFormat | GeometryArray.NORMALS) ; } if (curNormal == null) curNormal = new Vector3f() ; curNormal.set(normal) ; }
public void getVertexNormal(final Vertex v, final Vector3f ret) { ret.set(0, 0, 0); final Vector3f tn = new Vector3f(); for (final int fIdx : v.triangles) { getFaceNormal(fIdx, tn); ret.add(tn); } ret.normalize(); }
/** * Set the current normal that will be copied to each succeeding vertex * output by the decompressor. The per-vertex copy is needed since in * Java 3D a normal is always associated with a vertex. This method is * never called if normals are bundled with each vertex in the compressed * buffer. */ @Override void outputNormal(Vector3f normal) { if (debug) System.err.println(" outputNormal: " + normal.toString()) ; if ((vlist.vertexFormat & GeometryArray.NORMALS) == 0) { if (vlist.size() > 0) // Construct Shape3D using the current vertex format. addShape3D() ; // Start a new vertex list with the new format. vlist = new GeneralizedVertexList (vlist.vertexFormat|GeometryArray.NORMALS, FRONTFACE_CCW) ; } if (curNormal == null) curNormal = new Vector3f() ; curNormal.set(normal) ; }
/** * Sets this sound's direction from the vector provided. * @param direction the new direction */ void setDirection(Vector3f direction) { if (staticTransform != null) { staticTransform.transform.transform(direction, this.direction); } else { this.direction.set(direction); } dispatchAttribChange(DIRECTION_DIRTY_BIT, (new Vector3f(this.direction))); if (source != null && source.isLive()) { notifySceneGraphChanged(false); } }
private void setTransformation(final Matrix4f m, final Vector3f center, final boolean setMatrixField) { origin.set(center); try { final AxisAngle4f rot = new AxisAngle4f(); decompose(m, origin, rot, translation); angle = (float) (180 * rot.getAngle() / Math.PI); axis.x = rot.x; axis.y = rot.y; axis.z = rot.z; // update textfields axisTF.setText(toString(axis)); angleTF.setText(Float.toString(angle)); originTF.setText(toString(origin)); translationTF.setText(toString(translation)); if (setMatrixField) matrixTA.setText(toString(m)); transformationUpdated(m); } catch (final Exception e) { System.out.println(e.getMessage()); } }