POV-Ray : Newsgroups : povray.general : Problem using inside() with prism Server Time
30 Nov 2024 01:28:28 EST (-0500)
  Problem using inside() with prism (Message 1 to 2 of 2)  
From: Jörg Hubele
Subject: Problem using inside() with prism
Date: 19 Feb 2005 12:10:54
Message: <4217731e$1@news.povray.org>
There seems to be a bug when testing inside() with some prisms and a point 
on the bisector of an angle, where the bisector is the x-axis, but I 
haven't found any report on this. The following code should demonstrate the 
problem:

   #include "colors.inc"
   #default{finish{ambient 1}}
   camera {orthographic location 4*y look_at 0}
   background {color Gray50}

   #declare Bound =
   prism {
      linear_spline
      -1, 1, 3,

      //These don't work
      //<-1, 0>, < 1, 1>, < 0, 0>, < 1,-1>, <-1, 0>
      //< 1, 1>, <-1, 1>, < .5, 0>, <-1,-1>, < 1,-1>
      <-1, 1>, < 0, 0>, <-1,-1>
      //<-1,-1>, < 1, 0>, <-1, 1>

      //This one works as expected
      //< 1, 1>, < 0, 0>, < 1,-1>

      //rotate 360*y
   };

   object {Bound pigment {color Blue}}

   #declare j = -10;
   #while (j < 10)
      #declare i = -10;
      #while (i < 10)
         sphere {
            <i, 1, j>, .02
            pigment {
               #switch ( inside(Bound, <i, 0, j>) )
                  #case (0) color Red #break
                  #case (1) color Green #break
                  #else color Yellow #break
               #end
            }
         }
         #declare i = i+.25;
      #end
      #declare j = j+.25;
   #end


When I render this on PovWin 3.6.1a the spheres along the x-axis are all 
but one red even where the tested points are clearly inside the prism and 
should be green. The other prisms have similar problems and I can't 
reproduce this behavior along the z-axis. After rotating the prism object 
by 360 degrees around the y-axis, the inner spheres colors are correct. Can 
anyone confirm this?

I'm using Windows 2000 SP4 on an Intel P4 @ 1800 MHz with 512MB.



Post a reply to this message

From: Slime
Subject: Re: Problem using inside() with prism
Date: 19 Feb 2005 13:38:06
Message: <4217878e$1@news.povray.org>
> There seems to be a bug when testing inside() with some prisms and a point
> on the bisector of an angle

The prism insidedness test probably uses a trick that looks at how many
edges are to the left or right of the point being tested, and checks if that
number is odd. If there's a vertex of the prism along that line, then it
might not work right. So try translating the prism a tiny bit along the z
axis.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

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