POV-Ray : Newsgroups : povray.general : Q: What is a degenerate triangle? : Re: Q: What is a degenerate triangle? Server Time
12 Aug 2024 11:20:40 EDT (-0400)
  Re: Q: What is a degenerate triangle?  
From: Ron Parker
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

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