Hello

I'm creating simple 3D program for designing house and it involves sun movement (to see the brightness of the building at certain time).

As title says, I have three dimensional coordinate system and I have already defined the sun location at the certain time of the day

Code:

// where angle is from 0 to 180, it increments by 180/24h
x = -Math.cos(angle * Math.PI / 180);
y = Math.sin(angle * Math.PI / 180);
z = 0;

this code works if z is always the same.

My goal is to be able to rotate coordinate system (to rotate xy around z) so that I get new (virtual) x and y-axes. How should I change my formulas so that when I rotate my cs, the sun movement is still aligned with new x axis? (y stays the same, I need to modify x in z formulas).

I hope my question is clear enough. Thanks for your help in advance

Erdo