Skip to content

Commit

Permalink
RVec3: add 2 public methods
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Feb 24, 2025
1 parent 15886d6 commit 855f85f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/com/github/stephengold/joltjni/RVec3.java
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;

import com.github.stephengold.joltjni.operator.Op;
import com.github.stephengold.joltjni.readonly.RMat44Arg;
import com.github.stephengold.joltjni.readonly.RVec3Arg;
import com.github.stephengold.joltjni.readonly.Vec3Arg;

Expand Down Expand Up @@ -125,6 +126,15 @@ public RVec3 addLocal(double addX, double addY, double addZ) {
return this;
}

/**
* Set all components to 1.
*/
public void loadOne() {
this.xx = 1.;
this.yy = 1.;
this.zz = 1.;
}

/**
* Set all components to 0.
*/
Expand Down Expand Up @@ -281,6 +291,16 @@ public static RVec3 sZero() {
RVec3 result = new RVec3();
return result;
}

/**
* Transform the current vector by the specified matrix.
*
* @param matrix the transformation to apply (not null, unaffected)
*/
public void transformInPlace(RMat44Arg matrix) {
RVec3Arg temp = matrix.multiply3x4(this); // TODO garbage
set(temp);
}
// *************************************************************************
// RVec3Arg methods

Expand Down

0 comments on commit 855f85f

Please sign in to comment.