Dealing with floats in a litlle math library
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement