POV-Ray : Newsgroups : povray.general : Q: What is a degenerate triangle? : Re: Q: What is a degenerate triangle? Server Time
12 Aug 2024 11:19:19 EDT (-0400)
  Re: Q: What is a degenerate triangle?  
From: Gordon
Date: 24 Mar 1999 00:52:53
Message: <36f87db5.0@news.povray.org>
Spider,

Have a look at the code for my Simple Surface Macros in
binaries.scene-files. If you look through the code, you will see that it
calculates the normals. The key is that you need to average the normals of
the 6 (or whatever) triangles that meet at a particular corner. If you then
use this normal for that corner on each of the triangles, they will all be
smooth. In order to ensure you always get normals on the same side of the
surface, make sure that you do the cross products in the same order for
every corner.

For example, if you have a triangle with corners A, B, C defined in a
clockwise direction. Normal at A is vnormalize(vcross(B-A,C-A)), normal at B
is vnormalize(vcross(C-B,A-B)), and at C it is vnormalize(vcross(A-C,B-C)).
Note that the order of the corners is clockwise in each call, the normals
may be on the "top" or "bottom" but all will be on the same side.. Draw it
and see!

If this is not clear, let me know and I will try to explain in more detail,
with an example.

Regards
Gordon
<gtb### [at] birdcameroncomau>

Spider wrote in message <36F83193.8091B4A5@bahnhof.se>...
>While we are on the(off the) topic of tirangles, patches and so on..
>I'm working on a small landscape generator macro, and I'm not very
satisfied
>with the extreme high triangle count I'll need to make it visualised.
>
>I have the points in a 2D array, each storing a height value(sorta like a
>heightfield) I know all points are declared, so there are no such problems.
>
>Yes, I guess I could use smooth_triangle, but i don't know where the
normals
>would be, since I only have height data.
>I guess I could try and point all the normals UP, but that wouldn't be
really
>useful, would it?
>
>I came to think of using patches, but then... I'd have to use a loop to
split
>the big grid into smaller pieces, and then use four as corners, and the
rest as
>control points, I know it'd be looking nice, but there would be a mess to
set it
>up for me.
>
>Any tips/ideas ??
>My current render has a triangle count of :
>38416+355216 triangles....
>
>
>
>--
>//Spider
>        [ spi### [at] bahnhofse ]-[ http://www.bahnhof.se/~spider/ ]
>What I can do and what I could do, I just don't know anymore
>                "Marian"
>        By: "Sisters Of Mercy"


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.