4
votes
Accepted
How do fixed-point physics (engines) work?
TL;DR they work exactly the same; the difference comes from trade-offs like performance, value range and (sometimes) syntax.
It's is possible to simulate floating- or fixed-point math, you just have ...
4
votes
How can I rotate a 16-bit signed integer vector?
Use 32-bit integers for the intermediate calculations.
They'll usually be divided down into the 16-bit range at the end. If they're not - for example, rotating \$(30000,30000)\$ by an eighth-turn ...
4
votes
How can I rotate a 16-bit signed integer vector?
There are two issues to address here, each of which has a couple of solutions.
Size of vectors
Your first problem is how you do any processing at all without overflows. A vector (32767, 0) is clearly ...
2
votes
How can I rotate a 16-bit signed integer vector?
If you don't have a way to get the high half of a 16bit multiplication then you can instead scale the vector back before multiplying. (s and ...
1
vote
How can I rotate a 16-bit signed integer vector?
So...
you do not want to use 32 bits per integer;
you do not want to use float (or double);
you do not want to lose precision.
That cannot be done for the full range of numbers, but the precision ...
1
vote
How can I rotate a 16-bit signed integer vector?
I think the trick here is to use the fact that the hardware is usually more capable than the compiler exposes. In particular, when you multiply a 16 bit value by a 16 bit value, you will get a 32 bit ...
1
vote
How do fixed-point physics (engines) work?
I've been using FixedPoint (FxP) for last several years across multiple 8/16/32/64 bit platforms (mostly in Assembler).
The single most problematic issue with FxP is occasional overflow during ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
fixed-point × 7c × 2
c++ × 1
2d × 1
xna × 1
physics × 1
mathematics × 1
rotation × 1
graphics × 1
vector × 1
game-loop × 1
platformer × 1
sdl2 × 1
random × 1
physics-engine × 1
minecraft-modding × 1
trigonometry × 1
timestep × 1
fixed-timestep × 1
floating-point × 1
rasterization × 1