POV-Ray : Newsgroups : povray.newusers : giving varying object names to macros?? Server Time
30 Jul 2024 06:30:24 EDT (-0400)
  giving varying object names to macros?? (Message 1 to 3 of 3)  
From: Thorben
Subject: giving varying object names to macros??
Date: 16 Sep 2004 15:10:00
Message: <web.4149e439f8d128cd8a59baf60@news.povray.org>
I want to call my macro with varying objects, the object identifier is given
as a macro argument. example:

#declare result = mytraceenhancement(myobject5, <3,4,1>, <0,-1,0> ...)

Logical, trace thinks that "obj" is an object identifier and nothing else...

How to tell that it is a variable?

regards,

Thorben


Post a reply to this message

From: Thorben
Subject: Re: giving varying object names to macros??
Date: 17 Sep 2004 10:00:00
Message: <web.414aed0a3618a2f5a9d61c940@news.povray.org>
Funny, it seems that some part of my message got lost, so here are the
missing parts:
> I want to call my macro with varying objects, the object identifier is given
> as a macro argument. example:
>
> #declare result = mytraceenhancement(myobject5, <3,4,1>, <0,-1,0> ...)

#macro mytraceenhancement(obj, somepoint, somenormal, ...)
 #local resultnormal = <0,0,0>
 #local my_xyz = trace(obj, somepoint, somenormal,resultnormal)
 ... //enhancementstuff
#end

Logical, trace thinks that "obj" is the object identifier itself...

> How to tell that it is a variable?

i would like to do this like:

.... trace($OBJ, somepoint ...

but this does not work in povray, does it?

> regards,
>
> Thorben


Post a reply to this message

From: Florian Brucker
Subject: Re: giving varying object names to macros??
Date: 19 Sep 2004 14:57:10
Message: <414dd686$1@news.povray.org>
> but this does not work in povray, does it?

If I understand you correctly, you want to do something like this (code 
from shapes.inc):

#macro Isect(Pt, Dir, Obj, OPt)
    #local Norm = <0,0,0>;
    #local IPt = trace(Obj, Pt, Dir, Norm);
    #if (vlength(Norm) > 0)
       #declare OPt = IPt;
       #local Return=true;
    #else
       #local Return=false;
    #end
    (Return)
#end

HTH,
Florian
-- 
$ping http://www.real-life.org
ping: unknown host
[------------ http://www.torfbold.com - POV-Ray gallery ------------]


Post a reply to this message

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