Comments (6)
Box is a convex polytope and there are examples in src/testsuites for that. If you mean a general polytope then there is no example for that -- it would highly depend on the definition of the polytope anyway. If you need to work with polytopes just think about a proper support function (or search literature).
from libccd.
Thank you for you reply. If the convex polyhedron is defined as following:
Polyhedron:
vector<Polygon3D>;
Polygon3D:
uvec3 normal;
vector<vec3> points;
In the support function ccdSupport(const void * convex, const ccd_vec3_t *_dir, ccd_vec3_t *v)
, I need fill the variable v, which should be an intersection point between one Polygon3D and the ray with normal _dir
, and the intersection point should be the one that has maximum dot value with the normal.
Am i right?
from libccd.
Or just select the known points of the Polygon3D, like the following code segment, I copyed from here
I am doubting that the following way is OK.
static void ccdSupportConvex(const void *obj, const ccd_vec3_t *_dir, ccd_vec3_t *v)
{
const ccd_convex_t *c = (const ccd_convex_t *)obj;
ccd_vec3_t dir, p;
ccd_real_t maxdot, dot;
size_t i;
dReal *curp;
ccdVec3Copy(&dir, _dir);
ccdQuatRotVec(&dir, &c->o.rot_inv);
maxdot = -CCD_REAL_MAX;
curp = c->convex->points;
for (i = 0; i < c->convex->pointcount; i++, curp += 3){
ccdVec3Set(&p, curp[0], curp[1], curp[2]);
dot = ccdVec3Dot(&dir, &p);
if (dot > maxdot){
ccdVec3Copy(v, &p);
maxdot = dot;
}
}
// transform support vertex
ccdQuatRotVec(v, &c->o.rot);
ccdVec3Add(v, &c->o.pos);
}
from libccd.
The ccdSupportConvex() function seems ok -- the support point is the vertex from the polyhedron that is furthest along the direction vector (dot product says you the length of projection on the direction vector)... But if you are unsure, try some literature.
from libccd.
Now when I think about it, I think the code you posted was originaly written by me (as part of ODE physic SDK). So I would say it is correct. :)
from libccd.
Thanks. It is correct.
Some papers said that the procedure can be optimazed to constant time when in moving environment.
from libccd.
Related Issues (20)
- nextSupport function does not compute the right answer HOT 4
- Edge/Vertex order in ccd_pt_face_t HOT 1
- ccd_pt_vertex_t.edges is incorrectly assigned HOT 1
- Installation Crashing from executing make HOT 7
- findPenetr() can divide by zero.
- ccdVec3PointTriDist2() divides by zero. HOT 3
- Example from the 'GJK - Intersection Test' section fails HOT 1
- 'pkg-config --libs' shouldn't return -lm
- Enable compilation for ICC
- ccdVec3PointTriDist2 computes different distance with / without witness points. HOT 3
- M_PI not defined on test_gjk_libccd-inl_epa.cpp
- Warning C4273"inconsistent dll linkage" when build Static Library
- Fatal error: LNK1120 unresolved externals when libccd maked as static library HOT 1
- Examples in README are difficult to read and don't define all symbols they use HOT 3
- ccdGJKPenetration: Access violation reading location 0x0000000000000000. occurred HOT 7
- MPR - Penetration depth with any vector, not with MDT-vector - it's possible?
- ccdMPRPenetration() bug, wrong dir penetration depth HOT 36
- use CMAKE_INSTALL_DOCDIR insted of ${CMAKE_INSTALL_DATAROOTDIR}/doc/ccd
- Question: EPA Position Computation
- autotools install does not install header files.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libccd.