Rotate slopes of a plane around the Z axis in 3-dimensional space

198 Views Asked by At

I have a rectangular plane in 3D space, whose slope (height / length) along the X axis is say 0.3 and along the Y axis say 0.1. Now I rotate the plane around the Z axis by say 45°. How do I get the new slopes along X and Y axes respectively ? I've tried multiplying the slopes with sin(45) and / or cos(45), but both gave completely different results than I get by recreating that plane in a 3D design application (Blender), rotating it by 45° and calculating the slope from the vertex (point) positions.

EDIT: Here is a screenshot of a 3D rendering of the grid explained in the chat, on the left with both max-slope and max-bank = 0, at the right with both = 1 (raw terrain elevations without clamping). The problem is that for max-slope = 1 and max-bank = 0, applying the formula in the answer below, I get new max-slope = 0.328899 and max-bank = 0.944365, which results in no clamping at all in this example, and would result in insufficient clamping for steeper terrain.

Example image with unclamped "raw" terrain on the right and terrain clamped to 0% slope and bank on the left

If needed I can add more screenshots from different angles.

1

There are 1 best solutions below

8
On BEST ANSWER

If we represent positions (points) and displacements (vectors) by $3 \times 1$ columns of numbers, then rotating through angle $\theta$ about the $z$-axis is accomplished by multiplying on the left by the rotation matrix $$ R_{\theta} = \left[ \begin{array}{@{}ccc@{}} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \phantom{-}\cos\theta & 0 \\ 0 & 0 & 1 \end{array} \right]. $$ If the plane has normal vector $n = (A, B, C)$, the rotated plane has normal vector $$ R_{\theta} n = \left[ \begin{array}{@{}c@{}} A\cos\theta - B\sin\theta \\ A\sin\theta + B\cos\theta \\ C \end{array} \right]. $$