POV-Ray : Newsgroups : povray.general : Adding inside_vector (for CSG) to HF macros in shapes.inc : Re: Adding inside_vector (for CSG) to HF macros in shapes.inc Server Time
30 Jul 2024 16:13:10 EDT (-0400)
  Re: Adding inside_vector (for CSG) to HF macros in shapes.inc  
From: Zeger Knaepen
Date: 16 Oct 2008 18:47:50
Message: <48f7c496@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message 
news:48f7b570@news.povray.org...
> Zeger Knaepen <zeg### [at] povplacecom> wrote:
>> 'inside_vector', just like 'hollow', seems to be kind of magical to a lot 
>> of
>> users...  AFAIK there is NO NEED to specify inside_vector if you want to 
>> use
>> a properly closed mesh in CSG, since the default will do just fine.
>
>  I think you are confusing meshes+CSG with meshes+media.

no, I wasn't

>  The inside_vector indeed has nothing to do with media or other 'interior'
> features, and would be completely needless with them. As long as the mesh
> forms a closed surface, media inside it will render just fine.

I know, or at least I never saw any reason why it shouldn't

>  However, inside_vector *is* needed for intersection, difference and merge
> CSG to work properly with meshes. This is because these operations require
> to know if a given point is inside the mesh or not. If you don't use it,
> POV-Ray won't be able to calculate CSG properly in all situations.

you're saying there's no default-value for inside_vector?  I've never 
actually tried it, I just assumed so...
let's try something...

-- START CODE --
camera {location <2,3,-10> look_at 0}
light_source {<750,250,-500> rgb 1}
light_source {<500,500,-500> rgb <.5,.4,.3> shadowless}
#local Cube=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>}
 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>}
 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>}
 //inside_vector x
}

intersection {
 object {Cube}
 sphere {0,1.5}
 pigment {rgbt .5}
}
-- END CODE --

hmm, indeed, without inside_vector, POV-Ray doesn't seem to even try to 
check if a point is inside the mesh... why not? a default inside_vector 
seems trivial to me (if a mesh is well formed and closed, any vector will 
do, if it isn't, any vector still has a reasonable amount of chance it will 
work, so any vector should work in most cases) and result in the behaviour 
most users would expect (I actually had troubles figuring out why the 
background showed through the CSG).

cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message

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