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

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

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

origin: com.ardor3d/ardor3d-math

/**
 * @return same as multiplyLocal(-1)
 */
public Vector4 negateLocal() {
  return multiplyLocal(-1);
}
origin: Renanse/Ardor3D

/**
 * @return same as multiplyLocal(-1)
 */
public Vector4 negateLocal() {
  return multiplyLocal(-1);
}
origin: com.ardor3d/ardor3d-math

/**
 * Converts this vector into a unit vector by dividing it internally by its length. If the length is 0, (ie, if the
 * vector is 0, 0, 0, 0) then no action is taken.
 * 
 * @return this vector for chaining
 */
public Vector4 normalizeLocal() {
  final double lengthSq = lengthSquared();
  if (Math.abs(lengthSq) > MathUtils.EPSILON) {
    return multiplyLocal(MathUtils.inverseSqrt(lengthSq));
  }
  return this;
}
origin: Renanse/Ardor3D

/**
 * Converts this vector into a unit vector by dividing it internally by its length. If the length is 0, (ie, if the
 * vector is 0, 0, 0, 0) then no action is taken.
 * 
 * @return this vector for chaining
 */
public Vector4 normalizeLocal() {
  final double lengthSq = lengthSquared();
  if (Math.abs(lengthSq) > MathUtils.EPSILON) {
    return multiplyLocal(MathUtils.inverseSqrt(lengthSq));
  }
  return this;
}
origin: com.ardor3d/ardor3d-core

/**
 * Multiply and store a Vector3 in-buffer.
 * 
 * @param toMult
 *            the vector to multiply against
 * @param buf
 *            the buffer to find the Vector3 within
 * @param index
 *            the position (in terms of vectors, not floats) of the vector to multiply
 */
public static void multInBuffer(final ReadOnlyVector4 toMult, final FloatBuffer buf, final int index) {
  final Vector4 temp = Vector4.fetchTempInstance();
  populateFromBuffer(temp, buf, index);
  temp.multiplyLocal(toMult);
  setInBuffer(temp, buf, index);
  Vector4.releaseTempInstance(temp);
}
origin: Renanse/Ardor3D

/**
 * Multiply and store a Vector3 in-buffer.
 * 
 * @param toMult
 *            the vector to multiply against
 * @param buf
 *            the buffer to find the Vector3 within
 * @param index
 *            the position (in terms of vectors, not floats) of the vector to multiply
 */
public static void multInBuffer(final ReadOnlyVector4 toMult, final FloatBuffer buf, final int index) {
  final Vector4 temp = Vector4.fetchTempInstance();
  populateFromBuffer(temp, buf, index);
  temp.multiplyLocal(toMult);
  setInBuffer(temp, buf, index);
  Vector4.releaseTempInstance(temp);
}
origin: Renanse/Ardor3D

private void calculateIntersection(final double planeHeight, final ReadOnlyVector2 screenPosition,
    final ReadOnlyMatrix4 modelViewProjectionInverseMatrix) {
  origin.set(screenPosition.getX() * 2 - 1, screenPosition.getY() * 2 - 1, -1, 1);
  direction.set(screenPosition.getX() * 2 - 1, screenPosition.getY() * 2 - 1, 1, 1);
  modelViewProjectionInverseMatrix.applyPre(origin, origin);
  modelViewProjectionInverseMatrix.applyPre(direction, direction);
  direction.subtractLocal(origin);
  // final double t = (planeHeight * origin.getW() - origin.getY())
  // / (direction.getY() - planeHeight * direction.getW());
  if (Math.abs(direction.getY()) > MathUtils.EPSILON) {
    final double t = (planeHeight - origin.getY()) / direction.getY();
    direction.multiplyLocal(t);
  } else {
    direction.normalizeLocal();
    direction.multiplyLocal(mainCamera.getFrustumFar());
  }
  origin.addLocal(direction);
}
origin: com.ardor3d/ardor3d-effects

private void calculateIntersection(final double planeHeight, final ReadOnlyVector2 screenPosition,
    final ReadOnlyMatrix4 modelViewProjectionInverseMatrix) {
  origin.set(screenPosition.getX() * 2 - 1, screenPosition.getY() * 2 - 1, -1, 1);
  direction.set(screenPosition.getX() * 2 - 1, screenPosition.getY() * 2 - 1, 1, 1);
  modelViewProjectionInverseMatrix.applyPre(origin, origin);
  modelViewProjectionInverseMatrix.applyPre(direction, direction);
  direction.subtractLocal(origin);
  // final double t = (planeHeight * origin.getW() - origin.getY())
  // / (direction.getY() - planeHeight * direction.getW());
  if (Math.abs(direction.getY()) > MathUtils.EPSILON) {
    final double t = (planeHeight - origin.getY()) / direction.getY();
    direction.multiplyLocal(t);
  } else {
    direction.normalizeLocal();
    direction.multiplyLocal(mainCamera.getFrustumFar());
  }
  origin.addLocal(direction);
}
origin: Renanse/Ardor3D

public Vector3 getNormalizedDeviceCoordinates(final ReadOnlyVector3 worldPosition, Vector3 store) {
  if (store == null) {
    store = new Vector3();
  }
  checkModelViewProjection();
  final Vector4 position = Vector4.fetchTempInstance();
  position.set(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), 1);
  _modelViewProjection.applyPre(position, position);
  position.multiplyLocal(1.0 / position.getW());
  store.setX(position.getX());
  store.setY(position.getY());
  store.setZ(position.getZ());
  Vector4.releaseTempInstance(position);
  return store;
}
origin: com.ardor3d/ardor3d-core

public Vector3 getNormalizedDeviceCoordinates(final ReadOnlyVector3 worldPosition, Vector3 store) {
  if (store == null) {
    store = new Vector3();
  }
  checkModelViewProjection();
  final Vector4 position = Vector4.fetchTempInstance();
  position.set(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), 1);
  _modelViewProjection.applyPre(position, position);
  position.multiplyLocal(1.0 / position.getW());
  store.setX(position.getX());
  store.setY(position.getY());
  store.setZ(position.getZ());
  Vector4.releaseTempInstance(position);
  return store;
}
origin: com.ardor3d/ardor3d-core

    zDepth * 2 - 1, 1);
_modelViewProjectionInverse.applyPre(position, position);
position.multiplyLocal(1.0 / position.getW());
store.setX(position.getX());
store.setY(position.getY());
origin: Renanse/Ardor3D

    zDepth * 2 - 1, 1);
_modelViewProjectionInverse.applyPre(position, position);
position.multiplyLocal(1.0 / position.getW());
store.setX(position.getX());
store.setY(position.getY());
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);
}
com.ardor3d.mathVector4multiplyLocal

Javadoc

Internally modifies the values of this vector by multiplying them each by the given scalar value.

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
  • setW
    Sets the fourth component of this vector to the given double value.
  • setX
    Sets the first component of this vector to the given double value.
  • setW,
  • setX,
  • setY,
  • setZ,
  • dot,
  • fetchTempInstance,
  • getWf,
  • multiply,
  • normalizeLocal

Popular in Java

  • Making http post requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • getContentResolver (Context)
  • requestLocationUpdates (LocationManager)
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JLabel (javax.swing)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top plugins for WebStorm
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