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

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

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

origin: Renanse/Ardor3D

/**
 * Updates the values of the given vector from the specified buffer at the index provided.
 * 
 * @param vector
 *            the vector to set data on
 * @param buf
 *            the buffer to read from
 * @param index
 *            the position (in terms of vectors, not floats) to read from the buffer
 */
public static void populateFromBuffer(final Vector4 vector, final FloatBuffer buf, final int index) {
  vector.setX(buf.get(index * 4));
  vector.setY(buf.get(index * 4 + 1));
  vector.setZ(buf.get(index * 4 + 2));
  vector.setW(buf.get(index * 4 + 3));
}
origin: com.ardor3d/ardor3d-core

/**
 * Updates the values of the given vector from the specified buffer at the index provided.
 * 
 * @param vector
 *            the vector to set data on
 * @param buf
 *            the buffer to read from
 * @param index
 *            the position (in terms of vectors, not floats) to read from the buffer
 */
public static void populateFromBuffer(final Vector4 vector, final FloatBuffer buf, final int index) {
  vector.setX(buf.get(index * 4));
  vector.setY(buf.get(index * 4 + 1));
  vector.setZ(buf.get(index * 4 + 2));
  vector.setW(buf.get(index * 4 + 3));
}
origin: Renanse/Ardor3D

/**
 * Sets the value of this vector to (x, y, z, w)
 * 
 * @param x
 * @param y
 * @param z
 * @param w
 * @return this vector for chaining
 */
public Vector4 set(final double x, final double y, final double z, final double w) {
  setX(x);
  setY(y);
  setZ(z);
  setW(w);
  return this;
}
origin: com.ardor3d/ardor3d-math

/**
 * @param index
 *            which field index in this vector to set.
 * @param value
 *            to set to one of x, y, z or w.
 * @throws IllegalArgumentException
 *             if index is not one of 0, 1, 2, 3.
 * 
 *             if this vector is read only
 */
public void setValue(final int index, final double value) {
  switch (index) {
    case 0:
      setX(value);
      return;
    case 1:
      setY(value);
      return;
    case 2:
      setZ(value);
      return;
    case 3:
      setW(value);
      return;
  }
  throw new IllegalArgumentException("index must be either 0, 1, 2 or 3");
}
origin: com.ardor3d/ardor3d-math

/**
 * Sets the value of this vector to (x, y, z, w)
 * 
 * @param x
 * @param y
 * @param z
 * @param w
 * @return this vector for chaining
 */
public Vector4 set(final double x, final double y, final double z, final double w) {
  setX(x);
  setY(y);
  setZ(z);
  setW(w);
  return this;
}
origin: Renanse/Ardor3D

/**
 * @param index
 *            which field index in this vector to set.
 * @param value
 *            to set to one of x, y, z or w.
 * @throws IllegalArgumentException
 *             if index is not one of 0, 1, 2, 3.
 * 
 *             if this vector is read only
 */
public void setValue(final int index, final double value) {
  switch (index) {
    case 0:
      setX(value);
      return;
    case 1:
      setY(value);
      return;
    case 2:
      setZ(value);
      return;
    case 3:
      setW(value);
      return;
  }
  throw new IllegalArgumentException("index must be either 0, 1, 2 or 3");
}
origin: com.ardor3d/ardor3d-math

@Override
public void read(final InputCapsule capsule) throws IOException {
  setX(capsule.readDouble("x", 0));
  setY(capsule.readDouble("y", 0));
  setZ(capsule.readDouble("z", 0));
  setW(capsule.readDouble("w", 0));
}
origin: Renanse/Ardor3D

@Override
public void read(final InputCapsule capsule) throws IOException {
  setX(capsule.readDouble("x", 0));
  setY(capsule.readDouble("y", 0));
  setZ(capsule.readDouble("z", 0));
  setW(capsule.readDouble("w", 0));
}
origin: Renanse/Ardor3D

/**
 * Used with serialization. Not to be called manually.
 * 
 * @param in
 *            ObjectInput
 * @throws IOException
 * @throws ClassNotFoundException
 */
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
  setX(in.readDouble());
  setY(in.readDouble());
  setZ(in.readDouble());
  setW(in.readDouble());
}
origin: Renanse/Ardor3D

/**
 * Sets the value of this vector to the (x, y, z, w) values of the provided source vector.
 * 
 * @param source
 * @return this vector for chaining
 * @throws NullPointerException
 *             if source is null.
 */
public Vector4 set(final ReadOnlyVector4 source) {
  setX(source.getX());
  setY(source.getY());
  setZ(source.getZ());
  setW(source.getW());
  return this;
}
origin: com.ardor3d/ardor3d-math

/**
 * Used with serialization. Not to be called manually.
 * 
 * @param in
 *            ObjectInput
 * @throws IOException
 * @throws ClassNotFoundException
 */
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
  setX(in.readDouble());
  setY(in.readDouble());
  setZ(in.readDouble());
  setW(in.readDouble());
}
origin: com.ardor3d/ardor3d-math

/**
 * Sets the value of this vector to the (x, y, z, w) values of the provided source vector.
 * 
 * @param source
 * @return this vector for chaining
 * @throws NullPointerException
 *             if source is null.
 */
public Vector4 set(final ReadOnlyVector4 source) {
  setX(source.getX());
  setY(source.getY());
  setZ(source.getZ());
  setW(source.getW());
  return this;
}
origin: com.ardor3d/ardor3d-math

/**
 * Scales this vector by multiplying its values with a given scale value, then adding a given "add" value. The
 * result is store in the given store parameter.
 * 
 * @param scale
 *            the value to multiply by.
 * @param add
 *            the value to add
 * @param store
 *            the vector to store the result in for return. If null, a new vector object is created and returned.
 * @return the store variable
 */
@Override
public Vector4 scaleAdd(final double scale, final ReadOnlyVector4 add, final Vector4 store) {
  Vector4 result = store;
  if (result == null) {
    result = new Vector4();
  }
  result.setX(_x * scale + add.getX());
  result.setY(_y * scale + add.getY());
  result.setZ(_z * scale + add.getZ());
  result.setW(_w * scale + add.getW());
  return result;
}
origin: Renanse/Ardor3D

/**
 * Scales this vector by multiplying its values with a given scale value, then adding a given "add" value. The
 * result is store in the given store parameter.
 * 
 * @param scale
 *            the value to multiply by.
 * @param add
 *            the value to add
 * @param store
 *            the vector to store the result in for return. If null, a new vector object is created and returned.
 * @return the store variable
 */
@Override
public Vector4 scaleAdd(final double scale, final ReadOnlyVector4 add, final Vector4 store) {
  Vector4 result = store;
  if (result == null) {
    result = new Vector4();
  }
  result.setX(_x * scale + add.getX());
  result.setY(_y * scale + add.getY());
  result.setZ(_z * scale + add.getZ());
  result.setW(_w * scale + add.getW());
  return result;
}
origin: Renanse/Ardor3D

/**
 * Multiplies the given vector by this matrix (M * v). If supplied, the result is stored into the supplied "store"
 * vector.
 *
 * @param vector
 *            the vector to multiply this matrix by.
 * @param store
 *            the vector to store the result in. If store is null, a new vector is created. Note that it IS safe for
 *            vector and store to be the same object.
 * @return the store vector, or a new vector if store is null.
 * @throws NullPointerException
 *             if vector is null
 */
@Override
public Vector4 applyPost(final ReadOnlyVector4 vector, Vector4 store) {
  if (store == null) {
    store = new Vector4();
  }
  final double x = vector.getX();
  final double y = vector.getY();
  final double z = vector.getZ();
  final double w = vector.getW();
  store.setX(_m00 * x + _m01 * y + _m02 * z + _m03 * w);
  store.setY(_m10 * x + _m11 * y + _m12 * z + _m13 * w);
  store.setZ(_m20 * x + _m21 * y + _m22 * z + _m23 * w);
  store.setW(_m30 * x + _m31 * y + _m32 * z + _m33 * w);
  return store;
}
origin: com.ardor3d/ardor3d-math

/**
 * Performs a linear interpolation between this vector and the given end vector, using the given scalar as a
 * percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if
 * it is closer to 1, the result will be closer to the end value. The result is stored back in this vector.
 * 
 * @param endVec
 * @param scalar
 * @return this vector for chaining
 * 
 * 
 * @throws NullPointerException
 *             if endVec is null.
 */
public Vector4 lerpLocal(final ReadOnlyVector4 endVec, final double scalar) {
  setX((1.0 - scalar) * getX() + scalar * endVec.getX());
  setY((1.0 - scalar) * getY() + scalar * endVec.getY());
  setZ((1.0 - scalar) * getZ() + scalar * endVec.getZ());
  setW((1.0 - scalar) * getW() + scalar * endVec.getW());
  return this;
}
origin: Renanse/Ardor3D

/**
 * Performs a linear interpolation between this vector and the given end vector, using the given scalar as a
 * percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if
 * it is closer to 1, the result will be closer to the end value. The result is stored back in this vector.
 * 
 * @param endVec
 * @param scalar
 * @return this vector for chaining
 * 
 * 
 * @throws NullPointerException
 *             if endVec is null.
 */
public Vector4 lerpLocal(final ReadOnlyVector4 endVec, final double scalar) {
  setX((1.0 - scalar) * getX() + scalar * endVec.getX());
  setY((1.0 - scalar) * getY() + scalar * endVec.getY());
  setZ((1.0 - scalar) * getZ() + scalar * endVec.getZ());
  setW((1.0 - scalar) * getW() + scalar * endVec.getW());
  return this;
}
origin: com.ardor3d/ardor3d-math

/**
 * Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent.
 * iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the
 * result will be closer to the end value. The result is stored back in this vector.
 * 
 * @param beginVec
 * @param endVec
 * @param changeAmnt
 *            the scalar as a percent.
 * @return this vector for chaining
 * 
 * 
 * @throws NullPointerException
 *             if beginVec or endVec are null.
 */
public Vector4 lerpLocal(final ReadOnlyVector4 beginVec, final ReadOnlyVector4 endVec, final double scalar) {
  setX((1.0 - scalar) * beginVec.getX() + scalar * endVec.getX());
  setY((1.0 - scalar) * beginVec.getY() + scalar * endVec.getY());
  setZ((1.0 - scalar) * beginVec.getZ() + scalar * endVec.getZ());
  setW((1.0 - scalar) * beginVec.getW() + scalar * endVec.getW());
  return this;
}
origin: Renanse/Ardor3D

/**
 * Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent.
 * iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the
 * result will be closer to the end value. The result is stored back in this vector.
 * 
 * @param beginVec
 * @param endVec
 * @param changeAmnt
 *            the scalar as a percent.
 * @return this vector for chaining
 * 
 * 
 * @throws NullPointerException
 *             if beginVec or endVec are null.
 */
public Vector4 lerpLocal(final ReadOnlyVector4 beginVec, final ReadOnlyVector4 endVec, final double scalar) {
  setX((1.0 - scalar) * beginVec.getX() + scalar * endVec.getX());
  setY((1.0 - scalar) * beginVec.getY() + scalar * endVec.getY());
  setZ((1.0 - scalar) * beginVec.getZ() + scalar * endVec.getZ());
  setW((1.0 - scalar) * beginVec.getW() + scalar * endVec.getW());
  return this;
}
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);
}
com.ardor3d.mathVector4setW

Javadoc

Sets the fourth component of this vector to the given double 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
  • multiplyLocal
    Internally modifies the values of this vector by multiplying them each by the given scale values.
  • setX
    Sets the first component of this vector to the given double value.
  • multiplyLocal,
  • setX,
  • setY,
  • setZ,
  • dot,
  • fetchTempInstance,
  • getWf,
  • multiply,
  • normalizeLocal

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • compareTo (BigDecimal)
  • putExtra (Intent)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • String (java.lang)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Path (java.nio.file)
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • CodeWhisperer alternatives
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