Rotation Matrices Taking In Parameteric Equations

   1769   3   1
User Avatar
Member
63 posts
Joined: Aug. 2013
Offline
As I'm still having difficulty recognizing the differences between math and computer programming, I decided to try swapping out the typical rotation matrix construction [www.euclideanspace.com] using just sines and cosines of angles with a matrix that used expressions instead. I mean, basically the rotation handle's circular axes are each generated by OpenGL using the same sine/cosine function, and they also represent the rotation matrix that it's controlling. So why not introduce other shapes/geometric patterns [paulbourke.net] into the mix?

I hinted at this with my earlier post that showed how a super-ellipse at n1=n2=0 could potentially be use to drive the location of an object being used as an upVector to prevent singularities/flipping when/if the lookAt object is at the same location as the upVector. I've now tried my hand at a cardioid [paulbourke.net] cycloid, which I've attached here, and so far both rotation and scaling works as predicted. The only issues have been with the superellipse, because for some reason I couldn't can't write a simple sin^0(x) and cos^0(x) and had to resort to if/then, sign, and abs functions that slow down the whole thing because apparently using braces is expensive… [betterexplained.com]

Another curiosity of mine is whether or not one can convert a 3d location into a rotation and scale matrix representation of that location. So far the closest I've gotten to finding out is by pretending the 3d location is a quaternion which I then convert to a matrix, but scaling by the distance between the location and the origin is proving to be hard to figure out…

Attachments:
emb_cardiodRotationMatrixTest.mp4 (287.2 KB)
embPolarInterp_cardiodDemo.hipnc (217.7 KB)

User Avatar
Member
474 posts
Joined: July 2005
Offline
Hi,

have you tried to set yout matrix directly? The only thing you need is an up vector, then you can use the direction itself and the cross product with up vector to build an orthogonal matrix.

Attachments:
embPolarInterp_cardiodDemoX.hipnc (212.0 KB)

User Avatar
Member
63 posts
Joined: Aug. 2013
Offline
I forgot to mention that the original goal was to convert a vector to a spherical/polar coordinate to the 3x3 rotate-scale portion of a 4x4 matrix. I'm not sure how to use up vectors with spherical/polar coordinates…
User Avatar
Member
63 posts
Joined: Aug. 2013
Offline
That being said, the cross product method does seem to be the closest thing to Blender's “stretchTo” constraint, so thanks, Azatulin!
  • Quick Links