POV-Ray : Newsgroups : povray.beta-test : vector operators in macros Server Time
1 Nov 2024 07:25:27 EDT (-0400)
  vector operators in macros (Message 1 to 3 of 3)  
From: David Wallace
Subject: vector operators in macros
Date: 1 Jul 2002 16:11:31
Message: <3d20b773@news.povray.org>
Duron 800MHz, 512 MB DDR, WinPOV RC6

POV seems to reject the use of the vector dot operator in macros:

#macro fnChamfer(s,c)
    max(abs(x)-(s).x, abs(y)-(s).y, abs(z)-(s).z,
abs(x)+abs(y)-(s).x-(s).y+c, abs(x)+abs(z)-(s).x-(s).z+c,
abs(y)+abs(z)-(s).y-(s).z+c)
#end

If my knowledge of macros is correct, then when I give POV the following
lines:

#declare lbSiz = <1.75, .75, .5>;
#declare lbCut = .15;

#declare lBrick = isosurface {
 function { fnChamfer(lbSiz*.5,lbCut) }
 max_gradient 10
 accuracy 0.005
 contained_by { box { -lbSiz*.5, lbSiz*.5 } }
}

I should get a valid object.  If the "s" variable proved not to be a valid
vector, the error would come upon parsing the substituted function{}
statement.  Instead POV rejects the abs(y)-(s).y at the macro definition,
indicating type checking at that point.  What is happening here?


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: vector operators in macros
Date: 1 Jul 2002 18:35:41
Message: <3d20d93d$1@news.povray.org>
In article <3d20b773@news.povray.org> , "David Wallace" 
<dar### [at] earthlinknet> wrote:

> POV seems to reject the use of the vector dot operator in macros:

No, your problem is that you are trying to access a vector inside a function
which isn't allowed.

    Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: David Wallace
Subject: Re: vector operators in macros
Date: 7 Jul 2002 03:11:14
Message: <3d27e992@news.povray.org>
Funny, I modified the function shortly after my first post and it worked:

#macro fnChamfer(sx,sy,sz,c)
max(abs(x)-sx,abs(y)-sy,abs(z)-sz,abs(x)+abs(y)-sx-sy+c,abs(x)+abs(z)-sx-sz+
c,abs(y)+abs(z)-sy-sz+c) #end

#declare lBrick = isosurface {
 function { fnChamfer(lbSiz.x*.5,lbSiz.y*.5,lbSiz.z*.5,lbCut) +
fnpCut(x,y,z)*lbCut*.2 }
 max_gradient 10
 accuracy 0.005
 contained_by { box { -lbSiz*.5, lbSiz*.5 } }
}

It's anything but efficient, but it proved your point.

"Thorsten Froehlich" <tho### [at] trfde> wrote in message
news:3d20d93d$1@news.povray.org...
> In article <3d20b773@news.povray.org> , "David Wallace"
> <dar### [at] earthlinknet> wrote:
>
> > POV seems to reject the use of the vector dot operator in macros:
>
> No, your problem is that you are trying to access a vector inside a
function
> which isn't allowed.
>
>     Thorsten
>
> ____________________________________________________
> Thorsten Froehlich
> e-mail: mac### [at] povrayorg
>
> I am a member of the POV-Ray Team.
> Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

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