Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
24 May, 2013, 18:59:10 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 2 [3]   Go Down
  Print  
Author Topic: Rotation- How does it work?? -  (Read 1036 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
nxtboy III
LV8 Addict (Next: 1000)
********
Offline Offline

Last Login: 22 May, 2013, 02:53:41
Date Registered: 30 March, 2011, 22:57:58
Posts: 784


Topic starter
Total Post Ratings: +23

View Profile WWW
« Reply #30 on: 13 March, 2012, 23:27:48 »
0

How would I use fixed-point? Doesn't it have to be floating-point??

Could you explain "shearing" to me?

EDIT: But it involves skewing! How would I do that??
« Last Edit: 13 March, 2012, 23:32:09 by nxtboy III » Logged

christop
LV3 Member (Next: 100)
***
Offline Offline

Gender: Male
Last Login: 13 April, 2013, 04:04:55
Date Registered: 26 February, 2011, 19:58:44
Location: Arizona, USA
Posts: 87

Total Post Ratings: +20

View Profile
« Reply #31 on: 14 March, 2012, 02:29:10 »
0

How would I use fixed-point? Doesn't it have to be floating-point??
Fixed-point is just using values multiplied by a scaling factor, usually a power of two for efficiency. Say you have a 16-bit integer and you split it into 8 bits for the integer part and 8 bits for the fractional part. That's the same as multiplying a real (floating-point) number by 256 and then taking the integer portion. Then to add two fixed-point numbers, just add them as usual. To multiply two numbers, multiply them as usual and then divide by 256. To divide, multiply the numerator by 256 and then divide by the denominator. Since you probably won't want to write your own cosine and sine functions, you can still use the same ones after converting the fixed-point number back to floating point (cast it to float and divide by 256).

Of course, you can use more than 8 bits for the integer and fraction parts, and they don't have to be the same. How many bits you use depends on the range and precision you need and the size of the available integer types (16 and 32 being the most common).

Quote
Could you explain "shearing" to me?

EDIT: But it involves skewing! How would I do that??
Shearing is basically like taking a rectangle and moving the top and bottom in opposite directions so that you end up with a parallelogram. The top and bottom are the same length, and the parallelogram has the same height as the original rectangle, but the sides are longer than the original.

Here's a little illustration showing a rectangle getting x-sheared:

1
2
3
4
5
6
7
8
9
10
11
original:
  xxxxxx
  xxxxxx
  xxxxxx
  xxxxxx

x-sheared (alpha=-1):
xxxxxx
 xxxxxx
  xxxxxx
   xxxxxx
Y-shearing is the same but along the y axis. I can't help with an implementation for several reasons, such as that I don't even know what pixel format it uses. Besides, that link I gave you has an implementation in a Pascal-like language and one in Matlab.
Logged

Christopher Williams
nxtboy III
LV8 Addict (Next: 1000)
********
Offline Offline

Last Login: 22 May, 2013, 02:53:41
Date Registered: 30 March, 2011, 22:57:58
Posts: 784


Topic starter
Total Post Ratings: +23

View Profile WWW
« Reply #32 on: 14 March, 2012, 02:41:15 »
0

Do you think you could show some code for all the fixed/floating point stuff?

EDIT: BuilderBoy- Just to tell you, NXC (Language I use for my NXT) has some stuff that you can do in Axe/BASIC/Grammer, like checking if a pixel is on or off.
« Last Edit: 14 March, 2012, 03:58:13 by nxtboy III » Logged

Pages: 1 2 [3]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.175 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.