A more optimized rotator looks possible

  • 0 Replies


  • Trusty Member
  • ********
  • Replicant
  • *
  • 552
A more optimized rotator looks possible
« on: December 18, 2019, 05:00:36 pm »
As you guys may know,  my style of a.i. is for sport robots. (and its very similar to what Boston Dynamics, Open-AI, agility robotics, even deepmind are doing, its all about 'skill&strategy' rather than symbolic logic.)
And it comes down for me to sampling a physics engine enough times, to see the near future where it can just make a decision about which "route of postures" was better.

But that actually comes down to mostly just repeating just one thing,  a rotator!

The problem is, rotators usually take a divide and worse, even a square root to get the length of a vector,   and this Is way too costly to me, because I must get as many samples as possible,  but it looks like i'm in luck, there is faster solutions, and the way they made PlayStation 1 games ages ago, they used to get these matrix multiply operations we know today, in less work but it involves some kind of approximate loss to get it in less work.  I think im in luck with rotation, because it was easier to chop off than perspective texturing was.

So ive got in mind a lossy rotate, which will octagonalize the rotation.

First thing you can do, is u can at least get the 90 degree part of the rotation done first with flip and mirror,  then its just the nasty final attenuation in the quadrant left.
Then it helps if you decide on a fixed absolute amount of degree units your going to have in each quadrant.
You can get away with not normalizing it (to get rid of sqrt), if you make the unit rotation box, the size of the containing box of the vector,  but then unfortunately you get one multiply you have to do, to get how many segments you want in the rotation multiplied by how big the box is,  to split it into so many "radians"  but the cool thing is it only needs as many significant digits as radian units in a quadrant, so it could be 2 bits and youd still get 4 positions per quadrant.then if you get how much unit travel it is in the quadrant,   you could connect the dots with a lookup,  your basicly just taking the perpendicular motion, and turning it to diagonal motion.

~ 2 shifts,5 adders,3 inverts   <-so we think,  may be a bit optimistic at this stage.    and that's how they got those old games to even run at all back then!!!  but I spose ppl loved 3d more with ps1, so maybe the extra fun was worth it,  since it was all new back then.

SHIFT         //perpmovement=boundingboxside downshift how many angles in quadrant (must be a power of 2.)
?IF?              //get the vector and find what angle it is, using how far up the sides of the bounding box it is. and what quadrant it is. (but the angles are scaled to be the size of the box.)
ADD           //then add the rotation amount to it. which is in PERPMOVEMENT amounts.
SHIFT         //divide by how many units in a quadrant. (this is a downshift, its a power of 2.)
SUB            //get the difference of the quadrants. (invert, get 2's compliment - sub is an add)
INVERT      //then you mirror and flip due to the quadrant difference.
SUB           //subtract the quadrant position from the angle position, with the quadrant position shifted to the amount of angles in a quadrant.
ADDXY      //due to its vertical position, means it gets a different gradient, you can use a look up table. to carve the circle shape into the square.