Dealing with floats in a litlle math library

Started by
2 comments, last by jfclavette 19 years, 10 months ago
I''m in the process of making a few math helper classes, but I have a problem dealing with floats. Those appear mainly when testing equality, or a vector''s appartenance to a plane, etc. I figured I could use smoe kind of tolerance mechanism, allowing a specific delta interval where the components could be considered equal, but I''m not too sure... BTW, I''m mainly concerned with geometry for now, but open to suggestions. Which other classes could be useful ? As of now I haev Points, Lines, Planes, and Vectors. I might include Quaternions but I''m not acquainted much to them yet. I skipped triangles seeing that with triangle fans and strips, it becomes pretty useless.
I teleported home one night; With Ron and Sid and Meg; Ron stole Meggie's heart away; And I got Sydney's leg. <> I'm blogging, emo style
Advertisement
A 3x3 matrix class.
"I study differential and integral calculus in my spare time." -- Karl Marx
quote:Original post by xMcBaiNx
Those appear mainly when testing equality, or a vector''s appartenance to a plane, etc. I figured I could use smoe kind of tolerance mechanism, allowing a specific delta interval where the components could be considered equal, but I''m not too sure...

Yea I think that''s the way most does it. Just check if |a-b| is less than some EPSILON. I think there are ways to deduce what epsilon should be, but I don''t know how to do it.
Quite inelegant, and pretty inefficient too... Oh well, I''ll have to work with that I guess
I teleported home one night; With Ron and Sid and Meg; Ron stole Meggie's heart away; And I got Sydney's leg. <> I'm blogging, emo style

This topic is closed to new replies.

Advertisement