If you have seen the Popup Book tutorial for Cinema 4D by Robert Leger and want to know how to solve the problem in the mathematical way read below.
Here is the Robert’s tutorial:
This is my result:
I know that the following symbolism is not simple to read because I chose one that is ready to be transferred to COFFEE code and simple to write in this blog.
First of all, I want to fix my axes to take advantage of symmetry.
The origin is fixed on the point O. When the book is closing the two pages rotate together alpha degrees. I choose alpha as variable for the animation.
Now I want to have free choose of points: A and B.
The point A’ is symmetric respect to the ZY-plane by point A.
The point B stays on the plane x=0.
Now, with the book opened (alpha=0), I set the point A and B that I call _A and _B. In this manner I have set the distances OA,OB,AB that must be the same at any angle.
A(alpha=0)=_A=(X_A, Z_A, 0)
B(alpha=0)=_B=(0, Z_B, Y_B)
It is obvious that Y_A=X_B=0
Then X_A, Z_A,Z_B, Y_B are all set.
I’m searching a solution for points A and B:
A=A(alpha)=(XA,,ZA,YA)=(X_A*cos(alpha), Z_A, X_A*sin(alpha))
A is solved. Note that XA^2+YA^2=X_A^2
B=(0, ZB, YB)
Now I’m searching a solution for B.
1) The point B describes a circumference with radius R equal to length OB.
ZB^2+YB^2=R^2 (note that also R^2=Z_B^2+Y_B^2)
2) The distance AB= constant
at any alpha:
after some steps, I found:
when alpha is fixed (YA fixed) this is an equation of a line (r):
The intersection of the two equations gives two solutions. I”ll choose the solution with YB>0.
Now let’s go on with the calculations.
For semplicity: K=Z_A*Z_B
1) YA*YB+Z_A*ZB=K => ZB=(K-YA*YB)/Z_A
Raplacing ZB of equation 1) in equation 2):
(YA^2+Z_A^2)*YB^2-2*K*YA*YB+(K^2-R^2*Z_A^2)=0 quadratic equation
The positive solution is:
Now I can Calculate ZB:
The problem is solved!
Now I can write a COFFEE node for the algorithm:
I hope this tutorial can be useful also just like a mathematic exercise.
Here is the file