Skip to content

Commit

Permalink
Add missing JavaDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
httpdigest committed Aug 18, 2020
1 parent f9868b4 commit 772b770
Show file tree
Hide file tree
Showing 9 changed files with 301 additions and 5 deletions.
14 changes: 14 additions & 0 deletions src/org/joml/Matrix4d.java
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,20 @@ public Matrix4d mulLocalAffine(Matrix4dc left, Matrix4d dest) {
return dest;
}

/**
* Multiply this matrix by the supplied <code>right</code> matrix.
* <p>
* The last row of the <code>right</code> matrix is assumed to be <code>(0, 0, 0, 1)</code>.
* <p>
* If <code>M</code> is <code>this</code> matrix and <code>R</code> the <code>right</code> matrix,
* then the new matrix will be <code>M * R</code>. So when transforming a
* vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
* transformation of the right matrix will be applied first!
*
* @param right
* the right operand of the matrix multiplication
* @return this
*/
public Matrix4d mul(Matrix4x3dc right) {
return mul(right, this);
}
Expand Down
77 changes: 77 additions & 0 deletions src/org/joml/Matrix4dc.java
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,48 @@ Matrix4d mul3x3(
*/
Vector4d transform(double x, double y, double z, double w, Vector4d dest);

/**
* Transform/multiply the given vector by the transpose of this matrix and store the result in that vector.
*
* @see Vector4d#mulTranspose(Matrix4dc)
*
* @param v
* the vector to transform and to hold the final result
* @return v
*/
Vector4d transformTranspose(Vector4d v);

/**
* Transform/multiply the given vector by the transpose of this matrix and store the result in <code>dest</code>.
*
* @see Vector4d#mulTranspose(Matrix4dc)
*
* @param v
* the vector to transform and to hold the final result
* @param dest
* will contain the result
* @return dest
*/
Vector4d transformTranspose(Vector4dc v, Vector4d dest);

/**
* Transform/multiply the vector <code>(x, y, z, w)</code> by the transpose of this matrix
* and store the result in <code>dest</code>.
*
* @param x
* the x coordinate of the vector to transform
* @param y
* the y coordinate of the vector to transform
* @param z
* the z coordinate of the vector to transform
* @param w
* the w coordinate of the vector to transform
* @param dest
* will contain the result
* @return dest
*/
Vector4d transformTranspose(double x, double y, double z, double w, Vector4d dest);

/**
* Transform/multiply the given vector by this matrix, perform perspective divide and store the result in that vector.
*
Expand All @@ -1404,6 +1446,21 @@ Matrix4d mul3x3(
*/
Vector4d transformProject(Vector4dc v, Vector4d dest);

/**
* Transform/multiply the given vector by this matrix, perform perspective divide
* and store the <code>x</code>, <code>y</code> and <code>z</code> components of the
* result in <code>dest</code>.
*
* @see Vector3d#mulProject(Matrix4dc, Vector3d)
*
* @param v
* the vector to transform
* @param dest
* will contain the result
* @return dest
*/
Vector3d transformProject(Vector4dc v, Vector3d dest);

/**
* Transform/multiply the vector <code>(x, y, z, w)</code> by this matrix, perform perspective divide and store the result in <code>dest</code>.
*
Expand Down Expand Up @@ -1646,6 +1703,26 @@ Matrix4d mul3x3(
*/
Vector3d transformDirection(double x, double y, double z, Vector3d dest);

/**
* Transform/multiply the 3D-vector <code>(x, y, z)</code>, as if it was a 4D-vector with w=0, by
* this matrix and store the result in <code>dest</code>.
* <p>
* The given 3D-vector is treated as a 4D-vector with its w-component being <code>0.0</code>, so it
* will represent a direction in 3D-space rather than a position. This method will therefore
* not take the translation part of the matrix into account.
*
* @param x
* the x coordinate of the direction to transform
* @param y
* the y coordinate of the direction to transform
* @param z
* the z coordinate of the direction to transform
* @param dest
* will hold the result
* @return dest
*/
Vector3f transformDirection(double x, double y, double z, Vector3f dest);

/**
* Transform/multiply the given 4D-vector by assuming that <code>this</code> matrix represents an {@link #isAffine() affine} transformation
* (i.e. its last row is equal to <code>(0, 0, 0, 1)</code>).
Expand Down
13 changes: 13 additions & 0 deletions src/org/joml/Matrix4fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,19 @@ Matrix4f mul3x3(
*/
Vector3f transformProject(Vector3fc v, Vector3f dest);

/**
* Transform/multiply the given vector by this matrix, perform perspective divide and store the result in <code>dest</code>.
*
* @see Vector4f#mulProject(Matrix4fc, Vector4f)
*
* @param v
* the vector to transform
* @param dest
* will contain the <code>(x, y, z)</code> components of the result
* @return dest
*/
Vector3f transformProject(Vector4fc v, Vector3f dest);

/**
* Transform/multiply the vector <code>(x, y, z)</code> by this matrix, perform perspective divide and store the result in <code>dest</code>.
* <p>
Expand Down
130 changes: 130 additions & 0 deletions src/org/joml/Quaternionfc.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,17 @@ public interface Quaternionfc {
*/
Vector3f transform(Vector3f vec);

/**
* Transform the given vector by the inverse of this quaternion.
* <p>
* This will apply the rotation described by this quaternion to the given vector.
*
* @param vec
* the vector to transform
* @return vec
*/
Vector3f transformInverse(Vector3f vec);

/**
* Transform the given vector by this unit quaternion.
* <p>
Expand Down Expand Up @@ -600,6 +611,24 @@ public interface Quaternionfc {
*/
Vector3f transform(float x, float y, float z, Vector3f dest);

/**
* Transform the given vector <code>(x, y, z)</code> by this quaternion
* and store the result in <code>dest</code>.
* <p>
* This will apply the rotation described by this quaternion to the given vector.
*
* @param x
* the x coordinate of the vector to transform
* @param y
* the y coordinate of the vector to transform
* @param z
* the z coordinate of the vector to transform
* @param dest
* will hold the result
* @return dest
*/
Vector3d transform(float x, float y, float z, Vector3d dest);

/**
* Transform the given vector <code>(x, y, z)</code> by the inverse of this quaternion
* and store the result in <code>dest</code>.
Expand All @@ -618,6 +647,37 @@ public interface Quaternionfc {
*/
Vector3f transformInverse(float x, float y, float z, Vector3f dest);

/**
* Transform the given vector <code>(x, y, z)</code> by the inverse of this quaternion
* and store the result in <code>dest</code>.
* <p>
* This will apply the rotation described by this quaternion to the given vector.
*
* @param x
* the x coordinate of the vector to transform
* @param y
* the y coordinate of the vector to transform
* @param z
* the z coordinate of the vector to transform
* @param dest
* will hold the result
* @return dest
*/
Vector3d transformInverse(float x, float y, float z, Vector3d dest);

/**
* Transform the given vector by the inverse of this unit quaternion.
* <p>
* This will apply the rotation described by this quaternion to the given vector.
* <p>
* This method is only applicable when <code>this</code> is a unit quaternion.
*
* @param vec
* the vector to transform
* @return vec
*/
Vector3f transformInverseUnit(Vector3f vec);

/**
* Transform the given vector by this unit quaternion
* and store the result in <code>dest</code>.
Expand Down Expand Up @@ -670,6 +730,26 @@ public interface Quaternionfc {
*/
Vector3f transformUnit(float x, float y, float z, Vector3f dest);

/**
* Transform the given vector <code>(x, y, z)</code> by this unit quaternion
* and store the result in <code>dest</code>.
* <p>
* This will apply the rotation described by this quaternion to the given vector.
* <p>
* This method is only applicable when <code>this</code> is a unit quaternion.
*
* @param x
* the x coordinate of the vector to transform
* @param y
* the y coordinate of the vector to transform
* @param z
* the z coordinate of the vector to transform
* @param dest
* will hold the result
* @return dest
*/
Vector3d transformUnit(float x, float y, float z, Vector3d dest);

/**
* Transform the given vector <code>(x, y, z)</code> by the inverse of this unit quaternion
* and store the result in <code>dest</code>.
Expand All @@ -690,6 +770,26 @@ public interface Quaternionfc {
*/
Vector3f transformInverseUnit(float x, float y, float z, Vector3f dest);

/**
* Transform the given vector <code>(x, y, z)</code> by the inverse of this unit quaternion
* and store the result in <code>dest</code>.
* <p>
* This will apply the rotation described by this quaternion to the given vector.
* <p>
* This method is only applicable when <code>this</code> is a unit quaternion.
*
* @param x
* the x coordinate of the vector to transform
* @param y
* the y coordinate of the vector to transform
* @param z
* the z coordinate of the vector to transform
* @param dest
* will hold the result
* @return dest
*/
Vector3d transformInverseUnit(float x, float y, float z, Vector3d dest);

/**
* Transform the given vector by this quaternion and store the result in <code>dest</code>.
* <p>
Expand Down Expand Up @@ -772,6 +872,36 @@ public interface Quaternionfc {
*/
Vector4f transformUnit(Vector4fc vec, Vector4f dest);

/**
* Transform the given vector by this unit quaternion.
* <p>
* This will apply the rotation described by this quaternion to the given vector.
* <p>
* Only the first three components of the given 4D vector are being used and set on the destination.
* <p>
* This method is only applicable when <code>this</code> is a unit quaternion.
*
* @param vec
* the vector to transform
* @return vec
*/
Vector4f transformUnit(Vector4f vec);

/**
* Transform the given vector by the inverse of this unit quaternion.
* <p>
* This will apply the rotation described by this quaternion to the given vector.
* <p>
* Only the first three components of the given 4D vector are being used and set on the destination.
* <p>
* This method is only applicable when <code>this</code> is a unit quaternion.
*
* @param vec
* the vector to transform
* @return vec
*/
Vector4f transformInverseUnit(Vector4f vec);

/**
* Transform the given vector by the inverse of this unit quaternion and store the result in <code>dest</code>.
* <p>
Expand Down
2 changes: 1 addition & 1 deletion src/org/joml/Vector2f.java
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ public Vector2f mul(Vector2fc v, Vector2f dest) {
}

/**
* Divide this Vector3f component-wise by another Vector3fc.
* Divide this Vector2f component-wise by another Vector2fc.
*
* @param v
* the vector to divide by
Expand Down
12 changes: 12 additions & 0 deletions src/org/joml/Vector2fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,18 @@ public interface Vector2fc {
* @return dest
*/
Vector2f div(float scalar, Vector2f dest);

/**
* Divide this Vector2f component-wise by another Vector2fc
* and store the result in <code>dest</code>.
*
* @param v
* the vector to divide by
* @param dest
* will hold the result
* @return dest
*/
Vector2f div(Vector2fc v, Vector2f dest);

/**
* Divide the components of this Vector2f by the given scalar values and store the result in <code>dest</code>.
Expand Down
12 changes: 12 additions & 0 deletions src/org/joml/Vector3dc.java
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,18 @@ public interface Vector3dc {
*/
Vector3d mul(Matrix3dc mat, Vector3d dest);

/**
* Multiply the given matrix <code>mat</code> with <code>this</code> and store the
* result in <code>dest</code>.
*
* @param mat
* the matrix to multiply this vector by
* @param dest
* will hold the result
* @return dest
*/
Vector3f mul(Matrix3dc mat, Vector3f dest);

/**
* Multiply the given matrix <code>mat</code> with <code>this</code> and store the
* result in <code>dest</code>.
Expand Down
28 changes: 28 additions & 0 deletions src/org/joml/Vector4dc.java
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,34 @@ public interface Vector4dc {
*/
Vector3d mulProject(Matrix4dc mat, Vector3d dest);

/**
* Add the component-wise multiplication of <code>this * a</code> to <code>b</code>
* and store the result in <code>dest</code>.
*
* @param a
* the multiplicand
* @param b
* the addend
* @param dest
* will hold the result
* @return dest
*/
Vector4d mulAdd(Vector4dc a, Vector4dc b, Vector4d dest);

/**
* Add the component-wise multiplication of <code>this * a</code> to <code>b</code>
* and store the result in <code>dest</code>.
*
* @param a
* the multiplicand
* @param b
* the addend
* @param dest
* will hold the result
* @return dest
*/
Vector4d mulAdd(double a, Vector4dc b, Vector4d dest);

/**
* Multiply this Vector4d by the given scalar value and store the result in <code>dest</code>.
*
Expand Down
Loading

0 comments on commit 772b770

Please sign in to comment.