rotating...

General project discussion area - What have you built with your Micro View

Moderators: phalanx, Help@GeekAmmo, marcus@geekammo

Post Reply
tester919
Posts: 3
Joined: Thu Jan 15, 2015 4:00 pm

rotating...

Post by tester919 » Wed Mar 11, 2015 6:33 pm

Hi I am interested in trying to make an arrow and rotating that arrow around. However I don't know how to rotate an object. Any math gurus out there know how to rotate this arrow by various degrees.

uView.line(26,19,26,45);
uView.line(26,45,40,45);
uView.line(40,19,40,46);
uView.line(18,18,27,18);
uView.line(40,18,50,18);
uView.line(17,18,33,2);
uView.line(49,18,33,2);

I looked at the rotating cube and I assume there is a lot of math which I didn't pay much attention to in school.

Thanks in advance

tester919
Posts: 3
Joined: Thu Jan 15, 2015 4:00 pm

Re: rotating...

Post by tester919 » Wed Mar 11, 2015 8:04 pm

I'm trying to create a compass... so trying to integrate the HMC5883L is anyone has any tips for that as well.

Help@GeekAmmo
Posts: 41
Joined: Fri Jul 18, 2014 11:45 am

Re: rotating...

Post by Help@GeekAmmo » Fri Mar 13, 2015 4:07 am

Hi tester919,

If you are creating a compass, it will be easier to redraw the arrow using XOR mode. First XOR draw the arrow display the arrow, second XOR draw the same arrow at the same location make it disappear. Then from the sensor work out the angle of the next draw.

If you look at our source code for the round widget, this will actually do similar to what you wanted to do. Just hacked the code and make the arrow turn round.

If the above suggestion is not suitable, then you might want to make the arrow as a bitmap arrow image in a memory block, then perform matrix rotation formula, and finally transfer the rotated memory to MicroView's memory. This sounds so much harder and slow.

Hope this helps.

Cheers
JP

Post Reply