Using variables and maths functions in .rad files

ah, of course! i remember that being mentioned in the tutorial :slight_smile: that might actually do all of the tasks that i had in mind because that command - as i understand it - can be called from within a bash script where i can define the geometric layout in more abstract terms.
thank you!
michael

路路路

On Aug 23, 2013, at 10:48 AM, Giovanni Betti wrote:

Dear Michael,

Have you had a look at the xform command?
http://radsite.lbl.gov/radiance/man_html/xform.1.html

It might just do what you are trying to achieve.

Best,

Giovanni

////////////////////////////////////////////////
Giovanni Betti
-----Original Message-----
From: Michael Bannert [mailto:[email protected]]
Sent: 23 August 2013 08:52
To: Radiance general discussion
Subject: [Radiance-general] Using variables and maths functions in .rad files

Dear Radiance experts,

When defining the geometry of objects in .rad files, is it possible to use variables and basic maths functions (especially trigonometric functions)? Standard bash syntax doesn't seem to work in that case (i.e. xPos = 5 and $xPos).

Specifically, the coordinates of some of my objects change as a function of angle. So instead of recalculating all the x, y, and z coordinates by hand it would be really useful to just define a new angle and let Radiance's oconv program use the updated Cartesian coordinates.

I somehow have this deep belief that this should be possible :slight_smile:

If you know a clever way to do this, please let me know.

Best wishes,
Michael

--
Michael Bannert, Dipl.-Psych.
Vision & Cognition Lab, Centre for Integrative Neuroscience, Univ. of T眉bingen & BCCN T眉bingen Otfried-M眉ller-Str. 25, 72076 T眉bingen, Germany
Phone: +49 - (0)7071 / 29 - 89031

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

--
Michael Bannert, Dipl.-Psych.
Vision & Cognition Lab, Centre for Integrative Neuroscience, Univ. of T眉bingen & BCCN T眉bingen
Otfried-M眉ller-Str. 25, 72076 T眉bingen, Germany
Phone: +49 - (0)7071 / 29 - 89031

Hi Michael,

you can use xform for most cases, but a very generic approach is to use !echo "$myVariable". You just have to export the variable before calling a Radiance command parsing the file. All lines starting with ! are expanded when the scene is parsed, so this is a generic method to include any text (which can be parameters for materials, geometries, complete Radiance scene objects).

Cheers, Lars.