Skip to content

Commit

Permalink
Fix for #128 (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzaeschke authored Oct 5, 2023
1 parent 54088d4 commit fd5fe08
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

--> See TODO.txt

## unreleased
- Fix DVector3.cross() returning always 0. [#128](https://github.com/tzaeschke/ode4j/issues/128)

## 0.5.1 - 2023-09-17
- Support for HiDPI screens / Apple Silicon/Retina. Contribution by valb3r,
[#126]https://github.com/tzaeschke/ode4j/issues/126
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/org/ode4j/math/DVector3.java
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,9 @@ public final DVector3 eqCross(DVector3C b, DVector3C c) {
@Override
public final DVector3 cross(DVector3C b) {
DVector3 a = new DVector3();
set0( a.get1()*b.get2() - a.get2()*b.get1() );
set1( a.get2()*b.get0() - a.get0()*b.get2() );
set2( a.get0()*b.get1() - a.get1()*b.get0() );
a.set0( get1()*b.get2() - get2()*b.get1() );
a.set1( get2()*b.get0() - get0()*b.get2() );
a.set2( get0()*b.get1() - get1()*b.get0() );
return a;
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/test/java/org/ode4j/math/DVector3Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ public void testAddScale(){
@Test
public void testCross1(){
DVector3C x = new DVector3(1, 2, 3);
DVector3 y = new DVector3(1.5, 3, 4.5);
DVector3 y = new DVector3(1.5, 3, 2);

DVector3 t = x.cross(y);
DVector3 t = new DVector3(x).cross(y);
DVector3 t2 = new DVector3();
OdeMath.dCalcVectorCross3(t2, x, y);
assertTrue(t2.isEq(t, 0));
Expand All @@ -234,7 +234,7 @@ public void testCross1(){
@Test
public void testCross2(){
DVector3 x = new DVector3(1, 2, 3);
DVector3 y = new DVector3(1.5, 3, 4.5);
DVector3 y = new DVector3(1.5, 3, 2);
DVector3 t = new DVector3();
assertFalse(x.isEq(y, 0));

Expand Down

0 comments on commit fd5fe08

Please sign in to comment.