[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] exact algebraic numbers?



Hello,

For my game I need to represent right isosceles triangles, and do operations including translation and rotation in 15 degree increments. Unfortunately, I cannot tolerate rounding error, because it will cause bad visual and gameplay artifacts. I'm thinking of representing points as vectors where the components are of the form

a + b * sqrt(2) + c * sqrt(3) + d * sqrt(6)

where a, b, c, and d are rationals. I believe numbers of this form are sufficient for my purposes, although I haven't worked out all the proofs yet. Anyway, I was wondering if anyone has done anything similar and can suggest a library I can use for manipulating such vectors before I go off and implement it myself.

Thanks!

--Mike