Hey all,
I've been working with a Gem abstraction called "supercube". Supercube is a cube of 3x3 curve3d planes. The common points are linked so that we always have a seamless volume.
The supercube has 27 unique points. I've been figuring out different ways of creating interesting forms using this structure.
So I had the great idea of using matrix rotation to rotate the control points on various axes to distort the cube. In order to get this to work I need to solve two problems:
A. I need to be able to do matrix-rotation fast and efficiently, and I'd rather not need an external to do it!
B. I need to query the current position of each point before I can rotate it.
For A I could:
What give me the best performance? (#2) What would benifit the user community most? What is the most performance for the time?
For B:
Any suggestions/advice would be apprecaited.
Thanks. B.
Hallo, B. Bogart hat gesagt: // B. Bogart wrote:
So I had the great idea of using matrix rotation to rotate the control points on various axes to distort the cube. In order to get this to work I need to solve two problems:
A. I need to be able to do matrix-rotation fast and efficiently, and I'd rather not need an external to do it!
I'm not sure that I understand what exactly you want to do, but to me it sounds as if this would be a simple task for zexy's matrix/mtx objects. Matrix rotation then simply is a multiplication of two matrices using [mtx_mult] rsp. [mtx_*] The only real problem then would be point B:
B. I need to query the current position of each point before I can rotate it.
namely building the matrices from the 3D data, but the needed data probably already is available somewhere.
Of course zexy is an external library, but I suppose it's installed more often than [py].
Frank Barknecht _ ______footils.org__
_ __latest track: "scans" _ http://footils.org/cms/show/41
Hey Frank,
How do I specify the angle of rotation using matrix multiplication?
Code I have used in the past has been:
for(i=0; i<8; i++) { tx = cos(zangle)*(points[i][0])+sin(zangle)*(points[i][1]); x1 = cos(yangle)*(tx)+sin(yangle)*(points[i][2])+200; y1 = (-sin(zangle))*(points[i][0])+cos(zangle)*(points[i][1])+200; z1 = (-sin(yangle))*(tx)+cos(yangle)*(points[i][2]); }
where "points" stores the positions of each point in a shape. I is the point # (8 points for a cube in this case) and [0]:X, [1]:Y and [2]:Z)
So the new position is set based on the previous position. What I can't remeber is what tx is for... when I already have x1, y1 and z1....
Using zexy can I just store the current position of the points in an matrix, do the rotation and replace the old positions with the rotated ones? Then the matrix itself is what stores the points and I'll dump it out as messages to set the control points.
I'll take a peek at the zexy matrix stuff...
Thanks for the tips. B.
Frank Barknecht wrote:
Hallo, B. Bogart hat gesagt: // B. Bogart wrote:
So I had the great idea of using matrix rotation to rotate the control points on various axes to distort the cube. In order to get this to work I need to solve two problems:
A. I need to be able to do matrix-rotation fast and efficiently, and I'd rather not need an external to do it!
I'm not sure that I understand what exactly you want to do, but to me it sounds as if this would be a simple task for zexy's matrix/mtx objects. Matrix rotation then simply is a multiplication of two matrices using [mtx_mult] rsp. [mtx_*] The only real problem then would be point B:
B. I need to query the current position of each point before I can rotate it.
namely building the matrices from the 3D data, but the needed data probably already is available somewhere.
Of course zexy is an external library, but I suppose it's installed more often than [py].
Ciao
Hallo, B. Bogart hat gesagt: // B. Bogart wrote:
How do I specify the angle of rotation using matrix multiplication?
Attached is an example for a rotation of a 3-dimensional vector around the x-axis, which is straight from a geometrY book like this: http://mathworld.wolfram.com/RotationMatrix.html
It's basically the same thing that you are doing, however it's simplified for educational purposes. ;) (The expr can be optimized a bit of course.)
Rotation simply is matrix multiplication using matrices which follow certain rules. For many purposes the three Rx, Ry and Rz matrices from the mathworld site are sufficient, which are easy to use in zexy-mtx objects. But you can also create more complex rotation matrices. For this some more math might be needed: http://mathworld.wolfram.com/EulerAngles.html
NB: I heard, that there is a nameclash somewhere with the [matrix] object so I always use the objects using their [mtx] abbreviation to be on the safe side.
Frank Barknecht _ ______footils.org__
_ __latest track: "scans" _ http://footils.org/cms/show/41