|
![](/i/fill.gif) |
In article <hfbqiukqi8tefqb6rb0o4sv5esm6eunlvt@4ax.com>,
W?odzimierz ABX Skiba <abx### [at] babilon org> wrote:
> You should really spend a little of time checking old posts and not waste own
> time to work with not efficient macros. Considering commented trace is some
> kind of your shortcut for some content you can write your stuff this way:
>
> #macro IInside(obj,vec)
> #local w = <1,2,3>;//trace(obj,vec,z);
> (w.gray=0)
> #end
Actually, the .gray conversion multiplies each component by a factor
(because each component has a different contribution to the total gray
value) and sums up the results. This usually works fine for colors, but
you have a point which may have negative components, so there are valid
results that will still give w.gray = 0. It is better to check each
component individually...but you are right in that the if() statement is
unnecessary.
#macro IInside(Obj, Vec)
#local W = <1,2,3>;//trace(obj,vec,z);
((W.x = 0) & (W.y = 0) & (W.z = 0))
#end
A shorter and clearer way (assuming you have math.inc included and don't
care about the macro overhead):
#macro IInside(Obj, Vec)
#local W = <1,2,3>;//trace(Obj, Vec, z);
(VZero(W))
#end
BTW, always use at least one upper-case letter in variable names, it
prevents conflicts with future keywords or standard include stuff. This
has happened before, I think the Liquid Spray include used "r" as a
name, which became a reserved keyword in MegaPOV.
--
Christopher James Huff <chr### [at] mac com>
POV-Ray TAG e-mail: chr### [at] tag povray org
TAG web site: http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |