POV-Ray : Newsgroups : povray.general : How to define the normal on a single triangle? (new pov-ray user) : Re: How to define the normal on a single triangle? (new pov-ray user) Server Time
2 Aug 2024 20:22:06 EDT (-0400)
  Re: How to define the normal on a single triangle? (new pov-ray user)  
From: Shay
Date: 22 Jul 2004 13:50:45
Message: <40fffe75$1@news.povray.org>
Christoph Hormann wrote:

> 
> The inside/outside of a triangle is determined by the order in
> which the vertices are given. 

Only works reliably for me with the triangles enclosed in a mesh. 
Comment out the "union {" in the following code and uncomment the "mesh 
{" to see the difference.

BTW, for Impress, the normal, should you still need it, can be figured 
like this:
#local Normal = vcross ( Ver2 - Ver1, Ver3 - Ver1 );

camera {
     orthographic
     location <5,5,-10>
     look_at <5,5,0>
     right 12*x
     up 12*3/4*y
}

#local r0 = seed(123);
union {
     #local c0 = 0; #while ( c0 < 10 )
         union {
         //mesh {
             triangle { <-1,-1,1>, <-1,1,-1>, <1,1,1> }
             triangle { <-1,-1,1>, <1,-1,-1>, <-1,1,-1> }
             triangle { <-1,-1,1>, <1,1,1>, <1,-1,-1> }
             triangle { <-1,1,-1>, <1,-1,-1>, <1,1,1> }
             rotate <rand(r0),rand(r0),rand(r0)>*360
             translate <rand(r0),rand(r0),rand(r0)>*10
         }
     #local c0 = c0 + 1; #end
     texture {
         pigment { rgb x }
         finish { ambient 1 }
     }
     interior_texture {
         pigment { rgb y }
         finish { ambient 1 }
     }
}

-Shay


Post a reply to this message

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