Something interesting in here: http://cs.gmu.edu/~jmlien/research/app-cd/
and here: http://codesuppository.blogspot.com/2006/08/approximate-convexdecomposition.html
Check'em out

Moderators: Sascha Willems, walaber
jay3d wrote:Something interesting in here: http://cs.gmu.edu/~jmlien/research/app-cd/
khaled wrote:Dear all,
You can find an implementation of the Hierarchical Approximate Convex Decomposition (HACD) here http://sourceforge.net/projects/hacd
--Khaled
#VRML V2.0 utf8
# Produced by 3D Studio MAX VRML97 exporter, Version 12, Revision 1.06
# Date: Sat May 07 10:28:14 2011
DEF Cylinder01 Transform {
translation -16.86 0 45.85
children [
DEF Cylinder01-TIMER TimeSensor { loop TRUE cycleInterval 3.333 },
Shape {
appearance Appearance {
material Material {
diffuseColor 0.3412 0.8784 0.7765
}
}
geometry DEF Cylinder01-FACES IndexedFaceSet {
ccw TRUE
solid TRUE
coord DEF Cylinder01-COORD Coordinate { point [
63.47 0 0, 31.73 0 -54.96, -31.73 0 -54.96, -63.47 0 0,
-31.73 0 54.96, 31.73 0 54.96, 63.47 139.5 0, 31.73 139.5 -54.96,
-31.73 139.5 -54.96, -63.47 139.5 0, -31.73 139.5 54.96,
31.73 139.5 54.96, 23.52 139.5 -39.15, 46.12 139.5 0,
-21.68 139.5 -39.15, -44.29 139.5 0, -21.68 139.5 39.15,
23.52 139.5 39.15, 46.12 13.55 0, 23.52 13.55 -39.15,
-21.68 13.55 -39.15, -44.29 13.55 0, -21.68 13.55 39.15,
23.52 13.55 39.15]
}
coordIndex [
0, 1, 7, -1, 7, 6, 0, -1, 1, 2, 8, -1, 8, 7, 1, -1, 2, 3, 9, -1,
9, 8, 2, -1, 3, 4, 10, -1, 10, 9, 3, -1, 4, 5, 11, -1,
11, 10, 4, -1, 5, 0, 6, -1, 6, 11, 5, -1, 4, 3, 2, -1,
2, 1, 0, -1, 4, 2, 0, -1, 5, 4, 0, -1, 13, 17, 11, -1,
13, 11, 6, -1, 12, 13, 6, -1, 12, 6, 7, -1, 12, 7, 8, -1,
14, 12, 8, -1, 14, 8, 9, -1, 15, 14, 9, -1, 15, 9, 10, -1,
16, 15, 10, -1, 16, 10, 11, -1, 16, 11, 17, -1, 18, 19, 20, -1,
20, 21, 22, -1, 18, 20, 22, -1, 23, 18, 22, -1, 19, 12, 14, -1,
14, 20, 19, -1, 18, 13, 12, -1, 12, 19, 18, -1, 21, 15, 16, -1,
16, 22, 21, -1, 20, 14, 15, -1, 15, 21, 20, -1, 23, 17, 13, -1,
13, 18, 23, -1, 22, 16, 17, -1, 17, 23, 22, -1]
}
}
]
}
for(unsigned long f = 0; f < m_nTriangles; f++)
{
i = m_triangles[f].X();
j = m_triangles[f].Y();
k = m_triangles[f].Z();
m_graph.m_vertices[f].m_distPoints[i].m_distOnly = false;
m_graph.m_vertices[f].m_distPoints[j].m_distOnly = false;
m_graph.m_vertices[f].m_distPoints[k].m_distOnly = false;
u = m_points[j] - m_points[i];
v = m_points[k] - m_points[i];
normal = u ^ v;
if (m_addExteraDistPoints)
{// we need a kd-tree structure to accelerate this part!
Vec3<double> seedPoint((m_points[i] + m_points[i] + m_points[k]) / 3.0);
long nhit = 0;
for(size_t f1 = 0; f1 < m_nTriangles; f1++)
{
i1 = m_triangles[f1].X();
j1 = m_triangles[f1].Y();
k1 = m_triangles[f1].Z();
u1 = m_points[j1] - m_points[i1];
v1 = m_points[k1] - m_points[i1];
normal1 = (u1 ^ v1);
if (normal * normal1 < 0.0)
{
nhit = IntersectRayTriangle(seedPoint, -normal, m_points[i1], m_points[j1], m_points[k1], distance);
if ((nhit==1) && (distance >0.0) && ((distMin > distance) || (faceIndex == m_nTriangles)))
{
distMin = distance;
faceIndex = f1;
}
}
}
if (faceIndex < m_nTriangles )
{
i1 = m_triangles[faceIndex].X();
j1 = m_triangles[faceIndex].Y();
k1 = m_triangles[faceIndex].Z();
m_graph.m_vertices[f].m_distPoints[i1].m_distOnly = true;
m_graph.m_vertices[f].m_distPoints[j1].m_distOnly = true;
m_graph.m_vertices[f].m_distPoints[k1].m_distOnly = true;
}
}
}
Users browsing this forum: No registered users and 7 guests