Ladder to DNA using Transformation Matrix In my last Graphic mid-term, the exam contained a Transformation Matrices problem, its statement was:

Question


  Rotate the following ladder to form a DNA-shaped ladder using a transformation matrix.




Notes


The ladder base must be kept as it is without any rotating.
The ladder lies in the  x-y plane.
The total rotating angle should equal 540 degrees.
The ladder step width = 2 * ladder step height (This image isn't drawn to scale).
Assume that the curves are straight lines.


First Idea

When I first read the problem statement, I thought of this basic trivial solution:


Translate the ladder such that the ladder's base is on the origin and the y-axis halves the ladder.
Rotate all points by the required angle which depends on the current point y value.
Translate the ladder back to it rotation.


Assume that $T(x,y)$ is the transformation matrix that will take care of translation to the origin and its inverse will return the ladder back to its original location, and $R_y(\theta)$ is the rotation matrix around y-axis to perform the rotation to achieve the DNA-shaped ladder.

If we calculate $\theta = 540/12 = 45$ degrees, then we need to rotate as following:


1st step by $0$ degrees (to maintain the fixed-base condition).
2nd step by $45$ degrees.
3rd step by $90 = (2*45)$ degrees.


The problem

I couldn't apply this solution and put it into valid transformation matrix because referring to my previous knowledge (and the logic behind transformation matrices too), I recalled that we cannot put variables (e.g. y) inside the cos, sin functions inside the rotation matrix. Then I thought of another solution if I used power to the rotation matrix by the value of y this will give me the same effect but I also couldn't put this idea into a transformation matrix.

So, to conclude the problem we have 2 ways for achieving this (which I think aren't valid):


$\begin{bmatrix}\cos(y\theta)&amp;0&amp;\sin(y\theta)&amp;0\\0&amp;1&amp;0&amp;0\\-\sin(y\theta)&amp;0&amp;\cos(y\theta)&amp;0\\0&amp;0&amp;0&amp;1\end{bmatrix}$


And the final answer would be: $P' =  (T(x,y))^{-1} R(45) T(x,y) P$


$\begin{bmatrix}\cos(\theta)&amp;0&amp;\sin(\theta)&amp;0\\0&amp;1&amp;0&amp;0\\-\sin(\theta)&amp;0&amp;\cos(\theta)&amp;0\\0&amp;0&amp;0&amp;1\end{bmatrix}$


And the final answer would be: $P' =  (T(x,y))^{-1} (R(45))^{y} T(x,y) P$

Doctor's solution

My doctor was a big supporter of the first solution and he said this is the correct transformation matrix to solve such problems.

The real question


Do any of these solutions achieve the required result while maintaining the transformation matrix concepts (i.e. avoid equations and direct substitutions and instead use matrices operations)?
If both solutions are wrong, can you kindly guide me to the valid solution? 
If one of the solutions above is correct, can you please explain why?
You can't perform this transformation by applying constant transformation matrix to the ladder model since it's not linear transformation like joojaa said in the comments. What you would have to do instead is to define the transformation as a function of height as you have done in both of your proposals.

So both of your proposals are kind of correct, except for the typo in second one where you should use $R$ instead of $T$ that you raise to power of y. However, you might have difficulties raising a matrix to non-integer power (requires expansion of Taylor series, AFAIK), so your first proposal is much more practical.