private double[] getExtents(DxGeom g) { double[] extents = new double[6]; extents[0] = g.getAABB().getMin0(); extents[1] = g.getAABB().getMin1(); extents[2] = g.getAABB().getMin2(); extents[3] = g.getAABB().getMax0(); extents[4] = g.getAABB().getMax1(); extents[5] = g.getAABB().getMax2(); return extents; }
boolean Inside(DAABBC AABB){ // return AABB.get(AXIS0 * 2 + 0) >= MinX // && AABB.get(AXIS0 * 2 + 1) <= MaxX // && AABB.get(AXIS1 * 2 + 0) >= MinZ // && AABB.get(AXIS1 * 2 + 1) <= MaxZ; return AABB.getMin(AXIS0) >= mMinX && AABB.getMax(AXIS0) < mMaxX && AABB.getMin(AXIS1) >= mMinZ && AABB.getMax(AXIS1) < mMaxZ; }
private void drawAABB(DGeom g) { if (show_aabb) { // draw the bounding box for this geom DAABBC aabb = g.getAABB(); DVector3 bbpos = aabb.getCenter(); DVector3 bbsides = aabb.getLengths(); DMatrix3 RI = new DMatrix3(); RI.setIdentity (); dsSetColorAlpha (1,0,0,0.5f); dsDrawBox (bbpos,RI,bbsides); } }
private void drawAABB(DGeom g) { if (show_aabb) { // draw the bounding box for this geom DAABBC aabb = g.getAABB(); DVector3 bbpos = aabb.getCenter(); DVector3 bbsides = aabb.getLengths(); DMatrix3 RI = new DMatrix3(); RI.setIdentity (); dsSetColorAlpha (1,0,0,0.5f); dsDrawBox (bbpos,RI,bbsides); } }
private void drawAABB(DGeom g) { if (show_aabb) { // draw the bounding box for this geom DAABBC aabb = g.getAABB(); DVector3 bbpos = aabb.getCenter(); DVector3 bbsides = aabb.getLengths(); DMatrix3 RI = new DMatrix3(); RI.setIdentity (); dsSetColorAlpha (1,0,0,0.5f); dsDrawBox (bbpos,RI,bbsides); } }
boolean Inside(DAABBC AABB){ // return AABB.get(AXIS0 * 2 + 0) >= MinX // && AABB.get(AXIS0 * 2 + 1) <= MaxX // && AABB.get(AXIS1 * 2 + 0) >= MinZ // && AABB.get(AXIS1 * 2 + 1) <= MaxZ; return AABB.getMin(AXIS0) >= mMinX && AABB.getMax(AXIS0) < mMaxX && AABB.getMin(AXIS1) >= mMinZ && AABB.getMax(AXIS1) < mMaxZ; }
/** * Expand this AABB to include the given AABB. * @param aabb aabb */ public void expand(DAABBC aabb) { if (aabb.getMin0() < _min.get0()) _min.set0(aabb.getMin0()); if (aabb.getMin1() < _min.get1()) _min.set1(aabb.getMin1()); if (aabb.getMin2() < _min.get2()) _min.set2(aabb.getMin2()); if (aabb.getMax0() > _max.get0()) _max.set0(aabb.getMax0()); if (aabb.getMax1() > _max.get1()) _max.set1(aabb.getMax1()); if (aabb.getMax2() > _max.get2()) _max.set2(aabb.getMax2()); }
DVector3 bbpos = aabb.getCenter(); DVector3 bbsides = aabb.getLengths(); DMatrix3 RI = new DMatrix3(); RI.setIdentity();
/** * Expand this AABB to include the given AABB. * @param aabb aabb */ public void expand(DAABBC aabb) { if (aabb.getMin0() < _min.get0()) _min.set0(aabb.getMin0()); if (aabb.getMin1() < _min.get1()) _min.set1(aabb.getMin1()); if (aabb.getMin2() < _min.get2()) _min.set2(aabb.getMin2()); if (aabb.getMax0() > _max.get0()) _max.set0(aabb.getMax0()); if (aabb.getMax1() > _max.get1()) _max.set1(aabb.getMax1()); if (aabb.getMax2() > _max.get2()) _max.set2(aabb.getMax2()); }
DVector3 bbpos = aabb.getCenter(); DVector3 bbsides = aabb.getLengths(); DMatrix3 RI = new DMatrix3(); RI.setIdentity ();
DVector3 bbpos = aabb.getCenter(); DVector3 bbsides = aabb.getLengths(); DMatrix3 RI = new DMatrix3(); RI.setIdentity ();
private double[] getExtents(DxGeom g) { double[] extents = new double[6]; extents[0] = g.getAABB().getMin0(); extents[1] = g.getAABB().getMin1(); extents[2] = g.getAABB().getMin2(); extents[3] = g.getAABB().getMax0(); extents[4] = g.getAABB().getMax1(); extents[5] = g.getAABB().getMax2(); return extents; }
DVector3 bbpos = aabb.getCenter(); DVector3 bbsides = aabb.getLengths(); DMatrix3 RI = new DMatrix3(); RI.setIdentity();
/** * Checks whether the to AABBs are disjoint. * @param aabb2 aabb2 * @return <tt>false</tt> if the two AABBs overlap. */ @Override public boolean isDisjoint(DAABBC aabb2) { if (getMin0() > aabb2.getMax0() || getMax0() < aabb2.getMin0() || getMin1() > aabb2.getMax1() || getMax1() < aabb2.getMin1() || getMin2() > aabb2.getMax2() || getMax2() < aabb2.getMin2()) { return true; } return false; }
DVector3 bbpos = aabb.getCenter(); DVector3 bbsides = aabb.getLengths(); DMatrix3 RI = new DMatrix3(); RI.setIdentity();
/** * Checks whether the to AABBs are disjoint. * @param aabb2 aabb2 * @return <tt>false</tt> if the two AABBs overlap. */ @Override public boolean isDisjoint(DAABBC aabb2) { if (getMin0() > aabb2.getMax0() || getMax0() < aabb2.getMin0() || getMin1() > aabb2.getMax1() || getMax1() < aabb2.getMin1() || getMin2() > aabb2.getMax2() || getMax2() < aabb2.getMin2()) { return true; } return false; }
@Override public int dColliderFn(DGeom o1, DGeom o2, int flags, DContactGeomBuffer contacts) { DxGimpact trimesh = (DxGimpact) o2; GimTrimesh ptrimesh = trimesh.m_collision_trimesh; aabb3f test_aabb = new aabb3f(); DAABBC aabb = o1.getAABB(); test_aabb.minX = (float) aabb.getMin0(); test_aabb.maxX = (float) aabb.getMax0(); test_aabb.minY = (float) aabb.getMin1(); test_aabb.maxY = (float) aabb.getMax1(); test_aabb.minZ = (float) aabb.getMin2(); test_aabb.maxZ = (float) aabb.getMax2(); GimDynArrayInt collision_result = GimDynArrayInt.GIM_CREATE_BOXQUERY_LIST(); ptrimesh.getAabbSet().gim_aabbset_box_collision(test_aabb, collision_result); int contactcount = 0; if (collision_result.size() != 0) { int[] boxesresult = Arrays.copyOf(collision_result.GIM_DYNARRAY_POINTER(), collision_result.size()); ptrimesh.gim_trimesh_locks_work_data(); CollideConvexTrimeshTrianglesCCD collideFn = new CollideConvexTrimeshTrianglesCCD(); contactcount = collideFn.collide(o1, o2, boxesresult, flags, contacts); ptrimesh.gim_trimesh_unlocks_work_data(); } collision_result.GIM_DYNARRAY_DESTROY(); return contactcount; } }
@Override public int dColliderFn(DGeom o1, DGeom o2, int flags, DContactGeomBuffer contacts) { DxGimpact trimesh = (DxGimpact) o2; GimTrimesh ptrimesh = trimesh.m_collision_trimesh; aabb3f test_aabb = new aabb3f(); DAABBC aabb = o1.getAABB(); test_aabb.minX = (float) aabb.getMin0(); test_aabb.maxX = (float) aabb.getMax0(); test_aabb.minY = (float) aabb.getMin1(); test_aabb.maxY = (float) aabb.getMax1(); test_aabb.minZ = (float) aabb.getMin2(); test_aabb.maxZ = (float) aabb.getMax2(); GimDynArrayInt collision_result = GimDynArrayInt.GIM_CREATE_BOXQUERY_LIST(); ptrimesh.getAabbSet().gim_aabbset_box_collision(test_aabb, collision_result); int contactcount = 0; if (collision_result.size() != 0) { int[] boxesresult = Arrays.copyOf(collision_result.GIM_DYNARRAY_POINTER(), collision_result.size()); ptrimesh.gim_trimesh_locks_work_data(); CollideConvexTrimeshTrianglesCCD collideFn = new CollideConvexTrimeshTrianglesCCD(); contactcount = collideFn.collide(o1, o2, boxesresult, flags, contacts); ptrimesh.gim_trimesh_unlocks_work_data(); } collision_result.GIM_DYNARRAY_DESTROY(); return contactcount; } }