This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Rotation (sort of)


Rotation (sort of)

Postby Phantom » May 20, 2005 @ 9:35am

Give me some good data and
I will give you the world
User avatar
Phantom
pm Insider
 
Posts: 913
Joined: Feb 21, 2001 @ 8:14am
Location: Houten, Netherlands


Postby Dan East » May 20, 2005 @ 2:00pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Dan East » May 20, 2005 @ 2:06pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: Rotation (sort of)

Postby Kak » May 20, 2005 @ 3:55pm

User avatar
Kak
pm Member
 
Posts: 291
Joined: Jul 26, 2003 @ 12:24pm
Location: Zannarkand, Spira


Postby Phantom » May 20, 2005 @ 4:04pm

Give me some good data and
I will give you the world
User avatar
Phantom
pm Insider
 
Posts: 913
Joined: Feb 21, 2001 @ 8:14am
Location: Houten, Netherlands


Postby Kak » May 20, 2005 @ 7:40pm

User avatar
Kak
pm Member
 
Posts: 291
Joined: Jul 26, 2003 @ 12:24pm
Location: Zannarkand, Spira


Postby refractor » May 20, 2005 @ 10:25pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Andy » May 21, 2005 @ 12:44am

Andy
<font color=red size=3>Troll++</font>
 
Posts: 1288
Joined: Nov 1, 2003 @ 7:36am


Postby Kzinti » May 21, 2005 @ 1:04am

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby Andy » May 21, 2005 @ 1:22am

Andy
<font color=red size=3>Troll++</font>
 
Posts: 1288
Joined: Nov 1, 2003 @ 7:36am


Postby Tala » May 21, 2005 @ 3:49am

Tala
pm Member
 
Posts: 125
Joined: Feb 6, 2004 @ 4:32pm


Re: Rotation (sort of)

Postby fdave » May 23, 2005 @ 1:03am

---

Dave
E-mail: david (atsymbol) finalburn.com
WWW: http://www.finalburn.com/
User avatar
fdave
pm Member
 
Posts: 44
Joined: Apr 12, 2004 @ 10:01pm


Postby Phantom » May 23, 2005 @ 12:27pm

Dave,

Correct me if I'm wrong, but I think your formula is not correct. If I feed it x=30, y=2, I get:

((2-30+16)&31)-16 = (-12&31)-16, which equals -4.

For x=2, y=30 I get:

((30-2+16)&31)-16 = (44&31)-16, which equals -4 (should have been 4).

This could probably be corrected by xor'ing the sign bit of the (x+y+16) part. That's pretty much what refractor does. Great solution! Mind if I use it in a game? :) I'm glad my instincts where right: It's branchless...

Tala: Also correct me if I'm wrong, but if x=30 and y=2, your formula gives -28 (should have been 4).

- Jacco.
Give me some good data and
I will give you the world
User avatar
Phantom
pm Insider
 
Posts: 913
Joined: Feb 21, 2001 @ 8:14am
Location: Houten, Netherlands


Postby Digby » May 23, 2005 @ 4:22pm

Hi Jacco,

I'm curious, how many times are you calling this function per frame? If you're going to the trouble to worry about branches, is this bit of code a currently a bottleneck in your game?

For sake of discussion, let's say this code executed in one cycle - how much faster would it allow your game to run compared to the original implementation posted at the beginning of this thread? Would the user even notice it?
Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Postby refractor » May 23, 2005 @ 6:28pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Next

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum