Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DGeom.isSpace() #120

Merged
merged 1 commit into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
- [WARNING] bootstrap class path not set in conjunction with -source 8
when using: mvn clean install -P on-jdk-9-plus
- CI: Fail build on warning?!
- Return dxGeom in public API -> WHere is the TODO???

## 0.5.0 (unreleased)

- CHANGELOG.txt -> .md and added overview to README.md [#118](https://github.com/tzaeschke/ode4j/pull/118)
- DGeom.isSpace() [#120](https://github.com/tzaeschke/ode4j/pull/120)
- CHANGELOG.txt -> .md and added overview to README.md [#119](https://github.com/tzaeschke/ode4j/pull/119)
- Cumulative fix:
* Fixed missing call to Trimesh callbacks. [#76](https://github.com/tzaeschke/ode4j/issues/76)
* Deprecated DTriArrayCallback. It was never supported and is considered for removal in ODE.
Expand Down
13 changes: 6 additions & 7 deletions core/src/main/java/org/ode4j/ode/DGeom.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,11 @@ public interface DGeom {
DAABBC getAABB ();


// /**
// * Determing if a geom is a space.
// * @param geom the geom to query
// * @return Non-zero if the geom is a space, zero otherwise.
// */
// int isSpace();
/**
* Determing if a geom is a space.
* @return Non-zero if the geom is a space, zero otherwise.
*/
boolean isSpace();


/**
Expand Down Expand Up @@ -420,7 +419,7 @@ public interface DGeom {
* that those pairs should not interact.
*/
//typedef void dNearCallback (void *data, dGeom o1, dGeom o2);
public interface DNearCallback {
interface DNearCallback {
/**
* @param data The user data object, as passed to dSpaceCollide.
* @param o1 The first geom being tested.
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/ode4j/ode/internal/DxGeom.java
Original file line number Diff line number Diff line change
Expand Up @@ -1863,8 +1863,8 @@ public DMatrix3C getRotation()
public void setQuaternion (DQuaternionC quat)
{ dGeomSetQuaternion (quat); }

// public int isSpace()
// { return dGeomIsSpace (_id); }
public boolean isSpace()
{ return this instanceof DSpace; }

@Override
public void setCategoryBits (long bits)//unsigned long bits)
Expand Down
42 changes: 42 additions & 0 deletions core/src/test/java/org/ode4j/ode/DGeomTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*************************************************************************
* *
* Open Dynamics Engine 4J, Copyright (C) 2009-2023 Tilmann Zaeschke *
* All rights reserved. Email: ode4j@gmx.de Web: www.ode4j.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file ODE-LICENSE-BSD.TXT and ODE4J-LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT, ODE-LICENSE-BSD.TXT and ODE4J-LICENSE-BSD.TXT for more *
* details. *
* *
*************************************************************************/
package org.ode4j.ode;

import org.junit.Test;

import static org.junit.Assert.*;

public class DGeomTest {

/**
* DGeom::isSpace.
*/
@Test
public void testIsSpace() {
DSpace space = OdeHelper.createSimpleSpace();
assertTrue(space.isSpace());

DBox box = OdeHelper.createBox(1, 1, 1);
assertFalse(box.isSpace());
}
}