Skip to content

Commit

Permalink
QuatArg: add the conjugated() method
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Sep 17, 2024
1 parent d308434 commit 857e9c1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/github/stephengold/joltjni/Quat.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ public static Quat sRotation(Vec3 axis, float angle) {
// *************************************************************************
// QuatArg methods

/**
* Return the conjugate. The current object is unaffected.
*
* @return a new object
*/
@Override
public Quat conjugated() {
Quat result = new Quat(-x, -y, -z, w);
return result;
}

/**
* Return the real (W) component in single precision. The quaternion is
* unaffected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ of this software and associated documentation files (the "Software"), to deal
*/
package com.github.stephengold.joltjni.readonly;

import com.github.stephengold.joltjni.Quat;

/**
* Read-only access to a {@code Quat}. (native type: const Quat)
*
Expand All @@ -30,6 +32,13 @@ public interface QuatArg {
// *************************************************************************
// new methods exposed

/**
* Return the conjugate. The current object is unaffected.
*
* @return a new object
*/
Quat conjugated();

/**
* Return the real (W) component in single precision. The quaternion is
* unaffected.
Expand Down

0 comments on commit 857e9c1

Please sign in to comment.