# Affine Transformations in Rcalc?

I have a series of rays intended for input to rtrace. I would like to be able to rotate the starting point and direction of these around the origin. Is there any simple way to do this with rcalc ro some other Radiance tool, or do I have to find another way?

···

--
Randolph

You can use an appropriate rotation matrix a la:

Once you figure out the coefficients, you can apply them in dot products to your origins in rcalc. For example, rotating about the Y-axis by 41.7 degrees:

rcalc -e '\$3=\$3;\$4=\$4;\$5=\$5' \
-e 'th:41.7*PI/180' \
-e 'c11:cos(th);c12:0;c13:sin(th)' \
-e 'c21:0;c22:1;c23:0' \
-e 'c31:-sin(th);c32:0;c33:cos(th)' \
-e '\$1=c11*\$1+c12*\$2+c13*\$3' \
-e '\$2=c21*\$1+c22*\$2+c23*\$3' \
-e '\$3=c31*\$1+c32*\$2+c33*\$3' input.ray | rtrace ...

Hope this helps.
-Greg

···

From: "Randolph M. Fritz" <RFritz@lbl.gov>
Date: August 15, 2011 2:44:25 PM PDT

I have a series of rays intended for input to rtrace. I would like to be able to rotate the starting point and direction of these around the origin. Is there any simple way to do this with rcalc ro some other Radiance tool, or do I have to find another way?

--
Randolph

Small goof:

rcalc -e '\$4=\$4;\$5=\$5;\$6=\$6' \
-e 'th:41.7*PI/180' \
-e 'c11:cos(th);c12:0;c13:sin(th)' \
-e 'c21:0;c22:1;c23:0' \
-e 'c31:-sin(th);c32:0;c33:cos(th)' \
-e '\$1=c11*\$1+c12*\$2+c13*\$3' \
-e '\$2=c21*\$1+c22*\$2+c23*\$3' \
-e '\$3=c31*\$1+c32*\$2+c33*\$3' input.ray | rtrace ...

Also, I'm not sure if this gives you a clockwise or counter-clockwise rotation. You may have to experiment a bit.

-Greg

···

From: "Randolph M. Fritz" <RFritz@lbl.gov>
Date: August 15, 2011 2:44:25 PM PDT

I have a series of rays intended for input to rtrace. I would like to be able to rotate the starting point and direction of these around the origin. Is there any simple way to do this with rcalc ro some other Radiance tool, or do I have to find another way?

--
Randolph

Thanks, Greg!

Randolph

···

On 2011-08-15 15:29:03 -0700, Greg Ward said:

Small goof:

rcalc -e '\$4=\$4;\$5=\$5;\$6=\$6' \
-e 'th:41.7*PI/180' \
-e 'c11:cos(th);c12:0;c13:sin(th)' \
-e 'c21:0;c22:1;c23:0' \
-e 'c31:-sin(th);c32:0;c33:cos(th)' \
-e '\$1=c11*\$1+c12*\$2+c13*\$3' \
-e '\$2=c21*\$1+c22*\$2+c23*\$3' \
-e '\$3=c31*\$1+c32*\$2+c33*\$3' input.ray | rtrace ...

Also, I'm not sure if this gives you a clockwise or counter-clockwise rotation. You may have to experiment a bit.

-Greg

From: "Randolph M. Fritz" <RFritz@lbl.gov>
Date: August 15, 2011 2:44:25 PM PDT

I have a series of rays intended for input to rtrace. I would like to be able to rotate the starting point and direction of these around the origin. Is there any simple way to do this with rcalc ro some other Radiance tool, or do I have to find another way?

--
Randolph

--
Randolph