POV-Ray : Newsgroups : povray.newusers : User-defined object function Server Time
1 Nov 2024 21:22:02 EDT (-0400)
  User-defined object function (Message 1 to 3 of 3)  
From: Jan Fricke
Subject: User-defined object function
Date: 25 Nov 2004 10:35:01
Message: <web.41a5fb8fc0b0c1a6db7ce94a0@news.povray.org>
Hallo!
How can I define a function that constructs an object depending on a
parameter?
For exampel

ball(t, r)

should give something like

sphere { < t, 0, 0> , r}


Bets wishes             Jan


Post a reply to this message

From: Warp
Subject: Re: User-defined object function
Date: 25 Nov 2004 10:48:24
Message: <41a5fec8@news.povray.org>
Jan Fricke <fri### [at] mathuni-siegende> wrote:
> How can I define a function that constructs an object depending on a
> parameter?
> For exampel

> ball(t, r)

> should give something like

> sphere { < t, 0, 0> , r}

  Not possible with a function, but with a #macro it's easy:

#macro ball(T, R)
  sphere { <T, 0, 0>, R }
#end

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Jan Fricke
Subject: Re: User-defined object function
Date: 25 Nov 2004 16:12:00
Message: <41a64aa0$1@news.povray.org>
Warp wrote:
> Jan Fricke <fri### [at] mathuni-siegende> wrote:
> 
>>How can I define a function that constructs an object depending on a
>>parameter?
>>For exampel
> 
> 
>>ball(t, r)
> 
> 
>>should give something like
> 
> 
>>sphere { < t, 0, 0> , r}
> 
> 
>   Not possible with a function, but with a #macro it's easy:
> 
> #macro ball(T, R)
>   sphere { <T, 0, 0>, R }
> #end
> 

OK, thanks a lot for the fast answer.

Jan


Post a reply to this message

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