Since I'm very into optimizing my code, I want to use as much integers as much (only instead of other types of variables of course ). I looked in Mono & Disco's code, and there it uses single variables to calculate the screen coordinates for 3d models. Is it also possible to get a 3d model running at good performance (I mean that it runs smooth, the speed will be okay I think, integers are usally faster then singles)?

I think you need floating point math to prevent that the model is moving(rotating) weird, but I doubt if it's possible because Relsoft didn't use it in his code.

(most of Relsoft's code is optmized well).

Codemss

## Is it possible to do 3d math with only integers?

- Codemss
- Veteran
**Posts:**124**Joined:**Sun Jun 24, 2007 6:49 am**Location:**Utrecht, The Netherlands-
**Contact:**

### Is it possible to do 3d math with only integers?

Check out my site: <a href="http://members.lycos.nl/rubynl">Click here</a>

Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>

Codemss, before known as RubyNL

Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>

Codemss, before known as RubyNL

The only way I can think of is using large numbers and hoping they're large enough so that truncating is negligible. Or using UDTs, but that takes more memory.

I did manage to use only integers for rotation, but that was becuase of simplicity and eventually rounding errors did pop up after time (10 seconds of continual motion in certian directions ).

I did manage to use only integers for rotation, but that was becuase of simplicity and eventually rounding errors did pop up after time (10 seconds of continual motion in certian directions ).

For any grievances posted above, I blame whoever is in charge . . .

I'm actually working on creating my own fast 2D and 3D rotating routines,

for my ever-growing QB graphics library. After already implementing

the zooming/scaling routines earlier yesterday, I happened to read your

post today and I decided to do some bench-marks on my new routine.

Since I eliminated the floating point calculation by creating a matrix of precalculated variables I was a little curious if this approach would

actually be faster or not. Much to my suprise, after comparing the

routine using my optimizations, to the same routine using the floating

point calculation, there was a 400% speed increase. Even when I used

the FFix patch on the floating point routine, there was only about a 140% speed increase. (That's a big difference in speed for just removing one floating point operation!

Cya,

Nemesis

I've been using Doubles the entire time!Nemesis wrote:I was a little curious if this approach would

actually be faster or not. Much to my suprise, after comparing the

routine using my optimizations, to the same routine using the floating

point calculation, there was a 400% speed increase. Even when I used

the FFix patch on the floating point routine, there was only about a 140% speed increase. (That's a big difference in speed for just removing one floating point operation!

Cya,

Nemesis

For any grievances posted above, I blame whoever is in charge . . .

- Codemss
- Veteran
**Posts:**124**Joined:**Sun Jun 24, 2007 6:49 am**Location:**Utrecht, The Netherlands-
**Contact:**

Very nice! This was exactly what I was looking for! So did you whipe out all the floating point math or what? (I don't know much about matrices, except how to spell them )Nemesis wrote:Since I eliminated the floating point calculation by creating a matrix of precalculated variables I was a little curious if this approach would

actually be faster or not. Much to my suprise, after comparing the

routine using my optimizations, to the same routine using the floating

point calculation, there was a 400% speed increase. Even when I used

the FFix patch on the floating point routine, there was only about a 140% speed increase. (That's a big difference in speed for just removing one floating point operation! Smile

BTW, your graphics library sounds interesting. Have you got some demo's of it?

Check out my site: <a href="http://members.lycos.nl/rubynl">Click here</a>

Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>

Codemss, before known as RubyNL

Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>

Codemss, before known as RubyNL