Hi Folks, my first post here, so greetings and thanks for all the great topics I already looked at ;D
I’m searching quite a while now for something that I would call a generics compiler.
The Problem: I wrote a NavMesh class that calculates an approximation to the minimal convex polygons between obstacle polygons. It’s working quite fine, but sometimes I get floating-point related errors that lead to completely wrong meshes. To solve this I could use additional math to prevent this, but according to the site I found the formulas on it will add about 30% overhead and since I will need to update the mesh in-game I’m considering to change to integer arithmetic completely.
Now due to the IMO poor implementation of Java generics, I didn’t use them to abstract the base datatype because that would lead to a lot of autoboxing and unnecessary references. So what I imagine is something like this:
You have a class Vector in Vector.java. Now I want some tool that can produce a VectorI / VectorF class that would create the same class, with the same methods and so on just replace the BaseType by int/float (not Integer/Float). Another approach would be some sort of bytecode manipulation tool, that is able to completely replace all Vector with VectorF, but I think I would prefer the first approach since I would be able to do something like “manual partial specialization”.
Anyway, as I said I couldn’t find something like that.
Thanks for any advice!
Greetings,
Mene
PS: As you might have guessed I used to do most stuff with C++, so if my idea is just not a good “java-aproach”, please let me know ;D