Skip to content

Commit

Permalink
Add Vector4f.set(Vector3dc)
Browse files Browse the repository at this point in the history
  • Loading branch information
httpdigest committed Jun 30, 2023
1 parent 5b4d4c2 commit 158c926
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/org/joml/Vector4f.java
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,23 @@ public Vector4f set(Vector3fc v, float w) {
return this;
}

/**
* Set this {@link Vector4f} to the <code>(x, y, z)</code> components of the given <code>v</code>.
* <p>
* Note that due to the given vector <code>v</code> storing the components in double-precision,
* there is the possibility to lose precision.
*
* @param v
* the vector whose values will be copied into this
* @return this
*/
public Vector4f set(Vector3dc v) {
this.x = (float) v.x();
this.y = (float) v.y();
this.z = (float) v.z();
return this;
}

/**
* Set the first three components of this to the components of
* <code>v</code> and the last component to <code>w</code>.
Expand Down

0 comments on commit 158c926

Please sign in to comment.