please give your suggestions. im having a dfx object and i want to cut the object in slicing means im having 10/10 mm squere object. i want it to cut it in 10 parts so each part is containing 10 mm width and 1 mm height. and i also need it's vertex values in opengl.
so please send me the suggestions.
any suggestion most welcome
Helpful explaination of internal variables:
//(I replaced spaces with dots as they were not preserved in post?)
// I,J,K (points of current test triangle, indices or indirect indices)
// e0,e1 (edges from IK, JK)
// A (Area of current triangle, is actually area*2)
// N (Normal of current triangle, not unit length)
// p Test point if in current triangle.
Further testing shows that neither the old or new code correctly and consistently handles coincident and colinear points. (Eg. An example of a coincident point, is a Figure '8' polygons that does not actually cross over, just converges in the middle.)
// Eg. Coincident point, figure 8 style
poly normal (0.000f,-0.500f,0.866f)
This should help more with coincident points:
Old code in IsAnyPointInside():
if( ( ip < i || ip > k ) &&
if( ip < i || ip > k )
// NOTE: This is Vector3 exact equality test
continue; // Identical points are not inside, they do not hurt turns
if( IsPointInside(points[m_nIndex[ip]],points[ik]) )
If topus's suggested change is valid, it should read
// j is alligned from i to k ?
if( ((-FLT_EPSILON) < m_A && m_A < FLT_EPSILON) || // Area OR Poor Normal
((-FLT_EPSILON) < m_N && m_N < FLT_EPSILON &&
(-FLT_EPSILON) < m_N && m_N < FLT_EPSILON &&
(-FLT_EPSILON) < m_N && m_N < FLT_EPSILON ))
// NOTE: This code is more efficient on PC with eg. 'fabsf(m_A) <= FLT_EPSILON' to reduce float compares.
Also note that you can help the algorithm by removing 'junk' before processing. Eg. project 3D points onto plane (of which normal is used). Remove degeneracies like coincident and colinear points. Snapping and merging points may help, but could lead to bad-snaps that cause self intersections.
I have found another case which I believe shows a flaw in the algorithm. As 'ears' are clipped off the polygon, the remaining polygon can become self intersecting and fail 'point in poly' test, to produce triangles outside the original shape.
in function Triangulate()
in 'case convex :'
in else, after 'RemoveVertex'
// Advance to preserve poly integrity
i = j;
j = k;
This allows the point AFTER the removed triangle point to be the start of the next test triangle. This helps with near colinear points that fan out from an otherwise stationary start point.
There are still issues with the code. The bottom line is that the original algorithm does not handle simple non-covex polys with colinear, but non intersecting segments. The overall algorithm does not handle polygons that intersect in anyway, including at single points, though it often produces a correct or near correct result.
In my crossplatform c++ framework ( www.amanith.org ) i've implemented a fast sweepline tesselator that can handle non simple polygons with holes , and some common degenerations.
For every questions abuot this, email me at: email@example.com
I have read all libtess sources/docs, and got inspired during the writing of my tessellator, as weel as for another good paper, that explain the sweepline algorithm in details ( http://www.cs.ucsb.edu/~suri/cs235/Triangulation.pdf ).So, yes, i'll follow your suggestion adding the greetings to SGI.
My decision to rewite a tesselator instead of using the libtess ones is due to the fact that i had a try to be more robust and support more degeneration cases, without to introduce overheads of any kind.
Anyway, now, i'm oriented in a direction to use OpenGL drawing tecniques that don't need of the tesselation step, beacuse this step is too expensive, and it needs a too high robustness level.
Just for curiosity,
Are you using Amanith? Do u use the tessellation for drawing purposes or for something other?
( my mail is: mfabbri ]at[ amanith ]dot[ org )