Skip to content

Commit

Permalink
Vec3Arg: add the toRVec3() method
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Dec 8, 2024
1 parent 2b79e04 commit 416540f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/github/stephengold/joltjni/Vec3.java
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,18 @@ public float[] toArray() {

return result;
}

/**
* Copy the components to a new location vector. The current vector is
* unaffected.
*
* @return a new vector
*/
@Override
public RVec3 toRVec3() {
RVec3 result = new RVec3(x, y, z);
return result;
}
// *************************************************************************
// Object methods

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ of this software and associated documentation files (the "Software"), to deal
package com.github.stephengold.joltjni.readonly;

import com.github.stephengold.joltjni.Float3;
import com.github.stephengold.joltjni.RVec3;
import com.github.stephengold.joltjni.Vec3;
import java.nio.FloatBuffer;

Expand Down Expand Up @@ -234,4 +235,12 @@ public interface Vec3Arg {
* @return a new array with length=3
*/
float[] toArray();

/**
* Copy the components to a new location vector. The current vector is
* unaffected.
*
* @return a new vector
*/
RVec3 toRVec3();
}

0 comments on commit 416540f

Please sign in to comment.