English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 20 July 2009, 02: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
 
Old 20 July 2009, 12:06   #2
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
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, 12:35   #3
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
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, 14: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, 15:28   #5
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
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, 16:21   #6
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
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  
 


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 33 16 August 2023 20:29
C: Image rotation algorithm problem TikTok Coders. General 20 19 August 2019 20:15
Rotation matrix tolkien Coders. General 7 29 March 2013 10:32
aspi problem (was: auto resize problem) Kyon support.WinUAE 34 31 May 2009 16:56
Problem with Kickstarts [rare problem with faulty scripts in early v1.1 release] Topgun project.GameBase Amiga 14 08 June 2006 22: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 07:45.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09286 seconds with 13 queries