# 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:

1. Translate the ladder such that the ladder's base is on the origin and the y-axis halves the ladder.
2. Rotate all points by the required angle which depends on the current point y value.
3. 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):

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

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

1. $\begin{bmatrix}\cos(\theta)&0&\sin(\theta)&0\\0&1&0&0\\-\sin(\theta)&0&\cos(\theta)&0\\0&0&0&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?

• A transform like this is not a linear transform! Nov 18, 2016 at 15:13

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.