To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 2945
2944  |  2946
Subject: 
Re: Hidden surface removal, and vertex order in part/primitive DAT files
Newsgroups: 
lugnet.cad.dev
Date: 
Thu, 30 Sep 1999 19:22:25 GMT
Viewed: 
713 times
  
Hello,

Ok guys, I already announced that I coded such a tool in Java. At
present, only one Ldrawer has asked for the code. In fact, it's an alpha
release. Thus, I should find beta testers first. Anyway it has already
translated some pieces!

Here is a rough sketch of my algorithm. It's based on ray tracing too.
But, the algorithm presented by Gary has a major problem: it supposes
that the part IS a real solid, and this is not always the case. For some
parts, the quads/triangles did not sit exactly aside because of number
rounding problems. My first try (I also have this tool in alpha stage)
was to check the bricks for 'solidness'. I check all vertices to see if
they had very near neighbors and I replace all such neighbors by only
one vertex. But, I found this too cumbersome: I need 2 stages in the
process of translating the bricks...

After this unsuccessful try, I implemented a really simple, yet too
slow, kind of ray tracing:
1. Take a point in 3D space 'very' far away from the brick. Thus you're
sure you're outside.
2. Take one (non oriented) polygon of the brick.
3. Launch the ray from point to poly (use center or whatever point in
the poly)
4. Check for intersection of the ray and all brick polygons, and stop
when you've found the nearest poly to the point of step 1.
5. The outer normal of this poly is easy to figure out.
6. Orient the poly accordingly
7. Once this poly is oriented, you can also orient all the polys that
are connected to it (and so on): two connected polys share one edge.
This edge orientation is opposite in the tow polys.
8. Repeat from step 1 until all polys are oriented.

Remark: in step 1, one can use several strategies to get good
candidates. For example, use a bounding box of the brick, and take all
the corners of the box, all the centers of the faces, all the center of
the edges.

Clearly, it's not proven that this algo can orient all bricks. But it
can be a good start. One can also add some randomly chosen points, if
some polygons refuse to be oriented!

At present I still have some bugs to tracks and not enough time to code
:-(. But if interest about my code is growing, I'll try to do my best!

Last important point, my code may generate 2 versions of the same
component: the non solid components which have no inside and no outside
are generated twice. One instance has visible 'interior', the other has
visible 'exterior'



Message has 1 Reply:
  Re: Hidden surface removal, and vertex order in part/primitive DAT files
 
Jean-Pierre PARIS wrote in message <37F3B871.74AE196F@w...doo.fr>... (...) My algorithm doesn't require the vertices to exactly match; I was intending to pass one ray per polygon through the dat object, not an arbitrarily large number. And only if (...) (25 years ago, 30-Sep-99, to lugnet.cad.dev)

Message is in Reply To:
  Re: Hidden surface removal, and vertex order in part/primitive DAT files
 
(...) That should have read, for every polygon in the element or primitive. (25 years ago, 27-Sep-99, to lugnet.cad.dev)

56 Messages in This Thread:
















Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR