POV-Ray : Newsgroups : povray.general : Q: What is a degenerate triangle? Server Time
12 Aug 2024 13:12:19 EDT (-0400)
  Q: What is a degenerate triangle? (Message 31 to 37 of 37)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Spider
Subject: Re: Q: What is a degenerate triangle?
Date: 23 Mar 1999 19:32:26
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

From: Gordon
Subject: Re: Q: What is a degenerate triangle?
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

From: Nieminen Mika
Subject: Re: Q: What is a degenerate triangle?
Date: 24 Mar 1999 03:04:38
Message: <36f89c96.0@news.povray.org>
The calculation of the normals is also explained in detail in my
triangle mesh smoother, http://iki.fi/warp/PovUtils/smooth.html

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Spider
Subject: Re: Q: What is a degenerate triangle?
Date: 24 Mar 1999 08:26:23
Message: <36F8D70D.8FF188E3@bahnhof.se>
I'll look at it. Thanks.

<snipping the help>

-- 
//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

From: Spider
Subject: Re: Q: What is a degenerate triangle?
Date: 24 Mar 1999 08:26:25
Message: <36F8D72B.21C0682F@bahnhof.se>
Ok, thanks, I'll look at this as well.

Nieminen Mika wrote:
> 
>   The calculation of the normals is also explained in detail in my
> triangle mesh smoother, http://iki.fi/warp/PovUtils/smooth.html
> 
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/

-- 
//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

From: Ron Parker
Subject: Re: Q: What is a degenerate triangle?
Date: 24 Mar 1999 08:33:25
Message: <36f8e9a5.0@news.povray.org>
On Wed, 24 Mar 1999 01:28:03 +0100, Spider <spi### [at] bahnhofse> wrote:
>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?

A reasonable normal is the cross product of a vector pointing uphill at the 
steepest possible angle[1] and a vector pointing along a contour line.[2] 
If your height data is dense enough, you should be able to approximate those 
well enough.  

One problem you'll have with patches is that if you don't have enough data to 
generate the normals for a smooth triangle, you don't have enough to make the 
control points for a patch, either.

[1] Its projection in 2d would be the gradient, so if you add the the (x,y) 
gradient vector to the derivative of the height over that vector, times z, 
then normalize, you'll have the "uphill" vector.

[2] Its projection in 2d is perpendicular to the gradient, and its z component 
is zero by definition.  So it is just the gradient vector rotated by 90 degrees
about the z axis.


Post a reply to this message

From: david sharp
Subject: Re: Q: What is a degenerate triangle?
Date: 24 Mar 1999 11:06:14
Message: <36F90D8F.215E@interport.net>
Ron Parker wrote:
>						    The best understanding
> I've been able to formulate for a bicubic patch is that the four corners
> of a patch are always on the surface of the patch.  The other eight edge
> points are "control points" analogous to the "handles" on Bezier curves
> in programs like Corel Draw, Freehand, or Illustrator in that they define
> the beginning and ending direction of the curves that define the edges of
> the patch, as well as the "tension" at the corners.  These eight points
> also specify the surface normals at the four corners, sorta indirectly.
> 
> The four points in the middle of the patch are the hardest to understand,
> but I tend to visualize them as the same sort of "control points," except
> that the "anchors" they are associated with are not actually on the
> surface of the patch.  In a sense, they control how the surface slopes
> away from the edge curves, though their exact effect might not be
> immediately or intuitively obvious.

Thanks. This makes bicubics less intimidating.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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