pakachunka wrote:
> Hey Thomas,
> 
> thank you! The idea of pre-sorting is very good, specially because I 
> have a known number of triangles from start, so I can do a optimized 
> search tree.
> 
> However, I forgot to say that my mesh is not regular, that is, the 
> size and orientation of the triangles vary. 
> 
> So, when you say sort the points, what do you mean? Sort by the 
> distance to (x=0, y=0) calculated by pitagoras? Make two sorted 
> lists, one for x and another one for y? But them the triangle 
> vertice found in list X may not be the same found in list Y, right?
> 
> Thanks
> 
> Tor

Nope.  Here's an example (assume a Cartesian coordinate plane):

(20, 0), (5, -15), (0, 0)

Sorting these points top-to-bottom, left-to-right results in:

(0, 0), (20, 0), (5, -15)


That will help to do fast vertical elimination (the first point's y is 
guaranteed to be the top, the last point's y is guaranteed to be the 
bottom).  You may want to add an extra "point" that specifies the min x 
and max x values.  In other words, creating a virtual rectangle around 
each triangle.  Also called a "bounding box".

Each triangle in the mesh should know what its six adjacent neighbors 
are to drastically speed up future operations.  I assume you are going 
to scan horizontally across the display - if you only have to compare 
seven bounding boxes instead of hundreds or thousands, that will be a 
big performance gain.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to