last day (17 days later) » 

17:15
Hi
ಠ¯ಠ
Ok, so I'm creating a program for rotating an object in 3d around an arbitrary axis
*line (not object)
  //Thanks to en.wikipedia.org/wiki/…
  void rotateAtAround(float angle, PVector axis) {
    PVector buffer = new PVector(0,0,0);
    axis.normalize();
    buffer.x = this.endPoint.x*( cos(angle) +     pow(axis.x,2) *  ( 1-cos(angle) ) )
             + this.endPoint.y*( axis.x*axis.y*( 1-cos(angle) ) - axis.z*sin(angle) )
             + this.endPoint.z*( axis.x*axis.z*( 1-cos(angle) ) + axis.y*sin(angle) );

    buffer.y = this.endPoint.x*( axis.y*axis.x*( 1-cos(angle) ) + axis.z*sin(angle) )
You know you can use 3D transforms for rotation?
17:16
So I made it to rotate continuosly (forever) at PI/600 radians every time
@TuxCopter But I can't make it rotate around any random axis I choose (only for the x,y,z axes I can use the 3d rotation builtins)
if..else if...else
@KritixiLithos Continuing... the line rotates well for some time and then gets slower and slower for some weird reason
@TuxCopter What?
@Flp.Tkc Hi, can you help me?
float x = rand();
if (x < 1/3) rotateX(whatever);
else if (x < 2/3) rotateY(whatever);
else rotateZ(whatever);
@TuxCopter I don't mean random like that, I meant for any axis I choose
Then change the conditions to something deterministic
17:20
For example, let's say I wanted to rotate around the axis by the rector(100,-100,100), I can't do that normally
I can show you an animation of what goes wrong (gimme a minute)
And it seems to be a math error if it slow down
Or memory overflow
Or something
How is there an overflow? (the values are only very small)
what's going on?
17:25
Wait, I'll give you a gif
it's just that I'm trying to do 3d rotation (using a mathematical formula) and it is not working
It starts off normally, then slows down a lot
what kind of rotation? rotating camera around a point?
^ the lag is just the bad gif
So you can see that I'm trying to rotate the green line around the sphere below it
hm.. 3d rotation matrix. I had some old processing code which did this in one of my games. I'll see if I can dig it up
I remember using the same wiki page you're using
:)
I'm still debugging and I found out that rotating it by PI/2 actually rotates it over PI/2 radians
it looks like you've correctly done the formula
17:41
hmm... then something must be wrong in applying it
or displaying it
I rotate my Lines at setup so that they wouldn't constantly keep rotating (the gif above was just for debugging purposes)
The rotation is slightly crooked, I've noticed
When I remove the setMag to the Line's PVector, the green line seems to want to move away from the other spheres and the line gets longer and longer as it does that
I have no idea :(
17:59
Thanks for trying at least :) I think I will make a new sketch and start from nothing and make my way up
18:48
I created a new sketch. STILL THE SAME BUGı¨ÏØÍÎÔÏ˜Å˘ÍÎÒÓ¨Ï:kjsdfbNM˜∆˚ß∂ƒ∫˙jk
I starred my own post ^
19:13
I'm updating Processing now
19:51
Processing 3.2.something
Bye

  last day (17 days later) »