Codota Logo
Vector4.multiplyLocal
Code IndexAdd Codota 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)

  • Common ways to obtain Vector4
private void myMethod () {
Vector4 v =
  • Codota Iconnew Vector4()
  • Codota IconVector4.fetchTempInstance()
  • Codota IconReadOnlyVector4 src;new Vector4(src)
  • Smart code suggestions by Codota
}
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

  • Running tasks concurrently on multiple threads
  • requestLocationUpdates (LocationManager)
  • getContentResolver (Context)
  • orElseThrow (Optional)
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now