POV-Ray : Newsgroups : povray.bugreports : inside() results in: Parse Error: Expected 'operand', object identifier, found instead : Re: inside() results in: Parse Error: Expected 'operand',objectidentifier, = Server Time
3 Jun 2025 23:20:03 EDT (-0400)
  Re: inside() results in: Parse Error: Expected 'operand',objectidentifier, =  
From: Kenneth
Date: 1 Jun 2025 05:45:00
Message: <web.683c20344fbb0b93e83955656e066e29@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
>
> As always, a good job asking deeper questions, Kenneth. :-)
>

I never know if my questions are deeper-- or just crazy and uninformed, ha!

THANKS for your *multiple* examples of how to incorporate the V vector here.
Bald Eagle has been trying to 'enlighten' me for years as to the finer points of
writing user-defined functions, which are not my forte; but between the two of
you, I might just learn something!

Using several of your syntax examples, my two previously-failed function tests
work successfully now:

1) To get a visual indication on the z-plane of whether the V point is 'inside
or outside' the torus-as-object-pattern-function. (The plane will either be
totally black or totally white, due to the function's 'pattern' having two
default colors):

#declare Vx = V.x;
     #declare Vy = V.y;
     #declare Vz = V.z;
     #declare F2 = function { F(Vx,Vy,Vz) }
plane{-z,0
pigment { function {F2(Vx,Vy,Vz)}}
 finish{emission 1}
 }

I tested this with an animation, by varying the V-vector values. Of course, if I
move the z-plane from z=0 , the visual result will no longer exactly correspond
to the fixed position of the torus, which  is centered on <0,0,0>.

2) Far more useful! (This #if works because the two default colors of the
pattern function are pure black and white-- corresponding to boolean 0 and 1.)

 #if (!F(V.x,V.y,V.z))
         #declare AnsStr = "outside"
         #else
         #declare AnsStr = "inside"
 #end

#debug concat ("==> The test point V is ",AnsStr," <==\n")

-----------
By the way, one of your function examples was initially a mystery to me, because
I had never seen one like it:

declare F3 = function (x,y,z) {
         // Ugly way to fixed, parse time float arguments
         // in a function{} block context
         F(#local X=V.x;X*x, #local Y=V.y; Y*y, #local Z=V.y;Z*z)
         #undef X #undef Y #undef Z
     }

It finally occurred to me that each argument in the function is like a
'shorthand' version of:

#local X=V.x;
then...
X*x

I didn't know that values could be declared ( #local'ed here) *within* a
function statement, then immediately used.  Another new discovery! ;-)


Post a reply to this message

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