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 / 7217
7216  |  7218
Subject: 
Re: The use of type 5 lines for smoothing of objects.
Newsgroups: 
lugnet.cad.dev
Date: 
Mon, 13 May 2002 15:32:02 GMT
Viewed: 
448 times
  
Here follows a more explicit form of the algoritm:

For each dat file I make a map called Vertex2Normal

When I move the dat file I do the following thing for each optional line:

I call the 4 vertices in the line P0, P1, P2 and P3. Then I look at the
optional line as 2 triangles. Triangle P0,P2,P1 and triangle P0,P1,P3.

I calulate normals of the 2 triangles and add them together. Then I
normalise. Now you know the normal but not the sign. This doesn't matter.

Now you can put this data in the map:

    if(P0 is present in map) {
        Check inner product of value in map and calculated normal
        if(inner product > 0) {
            Add the normal to existing value;
        }
        else {
            Add minus the normal to existing value
        }
    }
    else {
        create new key, value pair; (Just assign the normal)
    }

    if(P1 is present in map) {
        Check inner product of value in map and calculated normal
        if(inner product > 0) {
            Add the normal to existing value;
        }
        else {
            Add minus the normal to existing value
        }
    }
    else {
        create new key, value pair; (Just assign the normal)
    }

The normals must be pointing approximately in the same direction so they
must be flipped if not.
When you want to draw a face you can check the map if the vertex is there.
If not take the flat normal of the face. If there is a smoother normal
present, then take the innerproduct of the flat norm of the face with the
smooth normal. If this turns out to be negative flip the norm. If the new
innner product with the smooth and the flat normal deviates much from one,
use the flat one. Do this to prevent accidental smoothing of edges. I use a
limit of 0.6 but I haven't checked too long for a optimal value.



Message is in Reply To:
  The use of type 5 lines for smoothing of objects.
 
Hello people, this is my first post. A few weeks ago I mailed with Travis Cobbs and Lars Hassing about an algorithm I constructed to make objects look smoother. This can be done by using per vertex normals and smooth shading. The normals can be (...) (23 years ago, 8-May-02, to lugnet.cad.dev)

22 Messages in This Thread:





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

Custom Search

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