English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 20 July 2009, 03:39   #1
rebb
 
Posts: n/a
2D Rotation problem

Finally my 2D rotator seems to rotate, at least sort of.
Still having huge problems to make it work right. After a while (angle value 150+), my x values goes out of the screen for no good reason

I got the same routine working with blitz basic (without sintable and with calculated radians). So my lucky guess is that my sintable still sucks. It's created with following: IS 0,450,1280,256,0,w,1,y,y
This should create sintable with 1.25 perioids and max value 256, so i can easily divide the result with 256 (asr.l #8). Anyone got ideas what i'm still doing wrong?

Full source:
http://paradise.untergrund.net/tmp/2dRot.s
 
AdSense AdSense  
Old 20 July 2009, 13:06   #2
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 5,586
Didn't check the code but my best bet is: sub.w d3,d2 is cause of your problem, it should be sub.l d3,d2.
StingRay is offline  
Old 20 July 2009, 13:35   #3
Leffmann

 
Join Date: Jul 2008
Location: Sweden
Posts: 2,025
The muls.w instruction produces a 32 bit product, and when you tell ASM-One to create a sinus table for this purpose you should select no half correction.
Leffmann is offline  
Old 20 July 2009, 15:00   #4
rebb
 
Posts: n/a
Quote:
Originally Posted by StingRay View Post
Didn't check the code but my best bet is: sub.w d3,d2 is cause of your problem, it should be sub.l d3,d2.
Now that i think of it, it makes perfect sense. And it works fine now.

Leffmann:
Changed the sinustable also. Could you please explain a little why half correction doesn't work here?
 
Old 20 July 2009, 16:28   #5
pmc
rebooting...
pmc's Avatar
 
Join Date: Apr 2007
Location: Elsewhere
Posts: 1,595
Quote:
Originally Posted by StingRay
Didn't check the code but my best bet is: sub.w d3,d2 is cause of your problem, it should be sub.l d3,d2.
Quote:
Originally Posted by Rebb
Now that i think of it, it makes perfect sense. And it works fine now.
More Jedi bug fixing from StingRay!

You sensed a disturbance in the code!

Gonna start calling you Obi-Wan
pmc is offline  
Old 20 July 2009, 17:21   #6
Leffmann

 
Join Date: Jul 2008
Location: Sweden
Posts: 2,025
Quote:
Originally Posted by rebb View Post
Now that i think of it, it makes perfect sense. And it works fine now.

Leffmann:
Changed the sinustable also. Could you please explain a little why half correction doesn't work here?
I think it adds half a degree to each degree for which it calculates a sine. There are times when you want this but for this sort of lookup table you want exact values, and if you inspect your table you will see there are no values equivalent to -1 and 1, which you would expect for all the right angles.
Leffmann is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mike the Magic Dragon: in-game problem or WinUAE problem? petran support.WinUAE 14 10 December 2013 16:12
Rotation matrix tolkien Coders. General 7 29 March 2013 11:32
aspi problem (was: auto resize problem) Kyon support.WinUAE 34 31 May 2009 17:56
C: Image rotation algorithm problem TikTok Coders. General 19 09 May 2007 20:31
Problem with Kickstarts [rare problem with faulty scripts in early v1.1 release] Topgun project.MAGE 14 08 June 2006 23:19

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 16:22.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.15205 seconds with 12 queries