POV-Ray : Newsgroups : povray.advanced-users : Macro in POV-ray : Re: Macro in POV-ray Server Time
16 May 2024 17:06:31 EDT (-0400)
  Re: Macro in POV-ray  
From: bakom
Date: 18 Oct 2014 22:10:01
Message: <web.54431b9f5ae0f3ce9532ba3c0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "bakom" <gswithbains> wrote:
> > I want to do azimuth and elevation so Rotate_Around_Trans() I think helps me.
> > But how to use it? Its not working when I write it as
> >
> > Rotate_Around_Trans(1.x, 2.x, 3.x, 1, 0, 0).
> >
> > How to make a macro in POV-ray? In documents I am unable to find it. Can I make
> > my own macro for azimuth and elevation?
>
>  Rotate_Around_Trans(Rotation, Point). Ordinary rotation operates around the
> origin, this macro rotates around a specific point.
> Parameters:
>
>     Rotation = The rotation vector, the same as the parameter to the rotate
> keyword.
>     Point = The point to rotate around.
>
>
> So,
> #include "transforms.inc"
>  object {My_Object Rotate_Around_Trans(z*90, <0, 0, 0>) }
>
> would rotate around the z-axis like usual.
>
> #include "transforms.inc"
>  object {My_Object Rotate_Around_Trans(z*90, <5, 0, 0>) }
>
> rotates around the z-axis where x=5.
>
> Macros are kinda like a subroutine.
> You define a macro by using the MACRO keyword
>
> #macro My_Macro (d, e, f)
>      #local g = d * 3;
>      sphere {<d, e, f>, g}
> #end
>
> #declare a = 1;
> #declare b = 2;
> #declare c = 3;
>
> My_Macro (a, b, c)
>
> The values plugged into the macro (a, b, and c) are copied over to the macro
> variables (e, f, and g) for use within the macro.
> The macro variable g is only defined within the macro - outside of the macro g
> is undefined.

Thanks a lot. :)
I make a macro named as Camera_rotation(a, b, c) and I am now able to rotate
camera. :)

Can we make a macro for a box? In which box is formed using 8 vertex?


Thanks
Gurwinder Singh Bains


Post a reply to this message

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