Tabnine Logo
Vector4.multiply
Code IndexAdd Tabnine to your IDE (free)

How to use
multiply
method
in
com.ardor3d.math.Vector4

Best Java code snippets using com.ardor3d.math.Vector4.multiply (Showing top 7 results out of 315)

origin: com.ardor3d/ardor3d-math

/**
 * @param store
 *            the vector to store the result in for return. If null, a new vector object is created and returned.
 * @return same as multiply(-1, store)
 */
@Override
public Vector4 negate(final Vector4 store) {
  return multiply(-1, store);
}
origin: Renanse/Ardor3D

@Test
public void testMultiply() {
  final Vector4 vec1 = new Vector4(1, -1, 2, -2);
  final Vector4 vec2 = vec1.multiply(2.0, null);
  final Vector4 vec2B = vec1.multiply(2.0, new Vector4());
  assertEquals(new Vector4(2.0, -2.0, 4.0, -4.0), vec2);
  assertEquals(new Vector4(2.0, -2.0, 4.0, -4.0), vec2B);
  vec2.multiplyLocal(0.5);
  assertEquals(new Vector4(1.0, -1.0, 2.0, -2.0), vec2);
  final Vector4 vec3 = vec1.multiply(vec2, null);
  final Vector4 vec3B = vec1.multiply(vec2, new Vector4());
  assertEquals(new Vector4(1, 1, 4, 4), vec3);
  assertEquals(new Vector4(1, 1, 4, 4), vec3B);
  final Vector4 vec4 = vec1.multiply(2, 3, 2, 3, null);
  final Vector4 vec4B = vec1.multiply(2, 3, 2, 3, new Vector4());
  assertEquals(new Vector4(2, -3, 4, -6), vec4);
  assertEquals(new Vector4(2, -3, 4, -6), vec4B);
  vec1.multiplyLocal(0.5, 0.5, 0.5, 0.5);
  assertEquals(new Vector4(0.5, -0.5, 1.0, -1.0), vec1);
  vec1.multiplyLocal(vec2);
  assertEquals(new Vector4(0.5, 0.5, 2.0, 2.0), vec1);
}
origin: Renanse/Ardor3D

/**
 * @param store
 *            the vector to store the result in for return. If null, a new vector object is created and returned.
 * @return same as multiply(-1, store)
 */
@Override
public Vector4 negate(final Vector4 store) {
  return multiply(-1, store);
}
origin: com.ardor3d/ardor3d-math

/**
 * Creates a new unit length vector from this one by dividing by length. If the length is 0, (ie, if the vector is
 * 0, 0, 0, 0) then a new vector (0, 0, 0, 0) is returned.
 * 
 * @param store
 *            the vector to store the result in for return. If null, a new vector object is created and returned.
 * @return a new unit vector (or 0, 0, 0, 0 if this unit is 0 length)
 */
@Override
public Vector4 normalize(final Vector4 store) {
  final double lengthSq = lengthSquared();
  if (Math.abs(lengthSq) > MathUtils.EPSILON) {
    return multiply(MathUtils.inverseSqrt(lengthSq), store);
  }
  return store != null ? store.set(Vector4.ZERO) : new Vector4(Vector4.ZERO);
}
origin: Renanse/Ardor3D

/**
 * Creates a new unit length vector from this one by dividing by length. If the length is 0, (ie, if the vector is
 * 0, 0, 0, 0) then a new vector (0, 0, 0, 0) is returned.
 * 
 * @param store
 *            the vector to store the result in for return. If null, a new vector object is created and returned.
 * @return a new unit vector (or 0, 0, 0, 0 if this unit is 0 length)
 */
@Override
public Vector4 normalize(final Vector4 store) {
  final double lengthSq = lengthSquared();
  if (Math.abs(lengthSq) > MathUtils.EPSILON) {
    return multiply(MathUtils.inverseSqrt(lengthSq), store);
  }
  return store != null ? store.set(Vector4.ZERO) : new Vector4(Vector4.ZERO);
}
origin: com.ardor3d/ardor3d-effects

private void modifyProjectionMatrix(final Vector4 clipPlane) {
  // Get the current projection matrix
  projectionMatrix = cam.getProjectionMatrix().toArray(projectionMatrix);
  // Get the inverse transpose of the current modelview matrix
  final ReadOnlyMatrix4 modelViewMatrixInvTrans = tRenderer.getCamera().getModelViewMatrix().invert(tmpMatrix)
      .transposeLocal();
  modelViewMatrixInvTrans.applyPre(clipPlane, clipPlane);
  // Calculate the clip-space corner point opposite the clipping plane
  // as (sgn(clipPlane.x), sgn(clipPlane.y), 1, 1) and
  // transform it into camera space by multiplying it
  // by the inverse of the projection matrix
  cornerPoint.setX((sign(clipPlane.getX()) + projectionMatrix[8]) / projectionMatrix[0]);
  cornerPoint.setY((sign(clipPlane.getY()) + projectionMatrix[9]) / projectionMatrix[5]);
  cornerPoint.setZ(-1.0);
  cornerPoint.setW((1.0 + projectionMatrix[10]) / projectionMatrix[14]);
  // Calculate the scaled plane vector
  final Vector4 scaledPlaneVector = clipPlane.multiply((2.0 / clipPlane.dot(cornerPoint)), cornerPoint);
  // Replace the third row of the projection matrix
  projectionMatrix[2] = scaledPlaneVector.getX();
  projectionMatrix[6] = scaledPlaneVector.getY();
  projectionMatrix[10] = scaledPlaneVector.getZ() + 1.0;
  projectionMatrix[14] = scaledPlaneVector.getW();
  // Load it back into OpenGL
  final Matrix4 newProjectionMatrix = tmpMatrix.fromArray(projectionMatrix);
  tRenderer.getCamera().setProjectionMatrix(newProjectionMatrix);
}
origin: Renanse/Ardor3D

private void modifyProjectionMatrix(final Vector4 clipPlane) {
  // Get the current projection matrix
  projectionMatrix = cam.getProjectionMatrix().toArray(projectionMatrix);
  // Get the inverse transpose of the current modelview matrix
  final ReadOnlyMatrix4 modelViewMatrixInvTrans = tRenderer.getCamera().getViewMatrix().invert(tmpMatrix)
      .transposeLocal();
  modelViewMatrixInvTrans.applyPre(clipPlane, clipPlane);
  // Calculate the clip-space corner point opposite the clipping plane
  // as (sgn(clipPlane.x), sgn(clipPlane.y), 1, 1) and
  // transform it into camera space by multiplying it
  // by the inverse of the projection matrix
  cornerPoint.setX((sign(clipPlane.getX()) + projectionMatrix[8]) / projectionMatrix[0]);
  cornerPoint.setY((sign(clipPlane.getY()) + projectionMatrix[9]) / projectionMatrix[5]);
  cornerPoint.setZ(-1.0);
  cornerPoint.setW((1.0 + projectionMatrix[10]) / projectionMatrix[14]);
  // Calculate the scaled plane vector
  final Vector4 scaledPlaneVector = clipPlane.multiply((2.0 / clipPlane.dot(cornerPoint)), cornerPoint);
  // Replace the third row of the projection matrix
  projectionMatrix[2] = scaledPlaneVector.getX();
  projectionMatrix[6] = scaledPlaneVector.getY();
  projectionMatrix[10] = scaledPlaneVector.getZ() + 1.0;
  projectionMatrix[14] = scaledPlaneVector.getW();
  // Load it back into OpenGL
  final Matrix4 newProjectionMatrix = tmpMatrix.fromArray(projectionMatrix);
  tRenderer.getCamera().setProjectionMatrix(newProjectionMatrix);
}
com.ardor3d.mathVector4multiply

Javadoc

Multiplies the values of this vector by the given scalar value and returns the result in store.

Popular methods of Vector4

  • <init>
    Constructs a new vector set to the (x, y, z, w) values of the given source vector.
  • set
    Sets the value of this vector to the (x, y, z, w) values of the provided source vector.
  • getW
  • getX
  • getY
  • getZ
  • addLocal
    Increments the values of this vector with the x, y, z and w values of the given vector.
  • getXf
  • getYf
  • getZf
  • multiplyLocal
    Internally modifies the values of this vector by multiplying them each by the given scale values.
  • setW
    Sets the fourth component of this vector to the given double value.
  • multiplyLocal,
  • setW,
  • setX,
  • setY,
  • setZ,
  • dot,
  • fetchTempInstance,
  • getWf,
  • normalizeLocal

Popular in Java

  • Start an intent from android
  • getExternalFilesDir (Context)
  • putExtra (Intent)
  • getContentResolver (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Menu (java.awt)
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now