pateman / dynamicaabbtree Goto Github PK
View Code? Open in Web Editor NEWDynamic AABB tree in Java for broadphase collision detection
License: The Unlicense
Dynamic AABB tree in Java for broadphase collision detection
License: The Unlicense
The following test case crashes:
@Test
public void shouldDetectRayIntersection() {
// Given
AABBTree<TestEntity> tree = givenTree();
Rayf ray = new Rayf(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f);
TestEntity entity1 = new TestEntity(1, 2.0f, 0.0f, 3.0f, 3.0f);
TestEntity entity2 = new TestEntity(2, -5.0f, 0.0f, 3.0f, 2.0f);
tree.add(entity1);
tree.add(entity2);
// When
List<TestEntity> intersecting = new ArrayList<>();
tree.detectRayIntersection(ray, intersecting);
tree.update(entity1);
tree.update(entity2);
tree.update(entity2);
tree.update(entity2);
// Then
assertEquals(1, intersecting.size());
assertEquals(1L, intersecting.get(0).getID());
}
Stacktrace:
java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 3
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:458)
at pl.pateman.dynamicaabbtree.AABBTree.getNodeAt(AABBTree.java:102)
at pl.pateman.dynamicaabbtree.AABBTree.balanceLeft(AABBTree.java:146)
at pl.pateman.dynamicaabbtree.AABBTree.balanceNode(AABBTree.java:199)
at pl.pateman.dynamicaabbtree.AABBTree.syncUpHierarchy(AABBTree.java:207)
at pl.pateman.dynamicaabbtree.AABBTree.insertNode(AABBTree.java:246)
at pl.pateman.dynamicaabbtree.AABBTree.add(AABBTree.java:292)
at pl.pateman.dynamicaabbtree.AABBTree.update(AABBTree.java:312)
at pl.pateman.dynamicaabbtree.AABBTreeTest.shouldDetectRayIntersection(AABBTreeTest.java:367)
@pateman The following reference http://www.randygaul.net/2013/08/06/dynamic-aabb-tree/ in the README.md file currently points to an inappropriate website. The original website is probably no longer active.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.