POV-Ray : Newsgroups : povray.newusers : CSG difference and 2D vectors : CSG difference and 2D vectors Server Time
5 Nov 2024 18:23:16 EST (-0500)
  CSG difference and 2D vectors  
From: Vincent Chevrier
Date: 26 Mar 1999 18:15:49
Message: <36FC1532.6F427660@club-internet.fr>
Hi everybody,
I'm a new user to POV-Ray and finally decided myself to ask for answers
on problems I discovered these last days.

-  CSG operation : I first thought about the "CSG pitfall" but it seems
to be a different configuration. I've got a box which is cut in the top
half by two other boxes. Why is the bottom half hollowed below the
intersection of the two smaller boxes? Here is some code for
understanding (remove the comment to see the effect) :
#version 3.1;
#include "colors.inc"
global_settings { assumed_gamma 1.0 }
camera {
   location  <70.0, 150.0, 150.0>
   look_at   <0.0, 70.0, 60.0>
}
light_source {
   <1000, 1000, 500>
   color White
}
light_source {
   <1000, 1000, -500>
   color White
}

difference {
   box { <0, 0, 0>, <42, 100, 119> pigment { color Red } }
   box { <4, 82, -10>, <38, 110, 130> pigment { color Blue } }
   //box { <-10, 82, 2>, <50, 110, 117> pigment { color Green } }
}
union {         // Positions of the 3 boxes
   box { <0, 0, 0>, <42, 100, 119> pigment { color Red } }
   box { <4, 82, -10>, <38, 110, 130> pigment { color Blue } }
   box { <-10, 82, 2>, <50, 110, 117> pigment { color Green } }
   translate <-60, 0, 0>
}
The bad effect disappears if one of the two boxes is raised by a small
amount. (OK, but I would like to understand :-)

- The second question deals with 2D vectors. Why is vlength(2*u)
different from vlength(VectA), with VectA=2*u? (u=<1, 0>)

#declare vectA = 2*u;
#declare vectB = <2, 0>;
#debug concat(str(vlength(2*u),1,1), "  -  ", str(vlength(vectA),1,1),
"  -  ", str(vlength(vectB),1,1))

gives :    2.0  -  3.5  -  3.5

Thanks for any explanation...


Post a reply to this message

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