From 9b7ebadf4a1d716094ec7ac2f4da5cbed896c029 Mon Sep 17 00:00:00 2001 From: stephengold Date: Mon, 23 Sep 2024 17:29:33 -0700 Subject: [PATCH] Vec3: add a copy constructor --- .../java/com/github/stephengold/joltjni/Vec3.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/github/stephengold/joltjni/Vec3.java b/src/main/java/com/github/stephengold/joltjni/Vec3.java index 373894de..fc669c6f 100644 --- a/src/main/java/com/github/stephengold/joltjni/Vec3.java +++ b/src/main/java/com/github/stephengold/joltjni/Vec3.java @@ -100,6 +100,17 @@ public Vec3(float[] array) { this.y = array[1]; this.z = array[2]; } + + /** + * Instantiate a copy of the argument. + * + * @param vec the vector to copy (not null, unaffected) + */ + public Vec3(Vec3Arg vec) { + this.x = vec.getX(); + this.y = vec.getY(); + this.z = vec.getZ(); + } // ************************************************************************* // new methods exposed