Yes. The trick is range reduction since atan doesn’t converge as fast. So there are many more choice trade-offs.
I had a rather unique situation where I was using a “circular heightmap”, a 1D heightmap that wraps around a circle with a certain resolution. I needed to find out what height index was closest to a certain point (= round(heightmapResolution * atan2(dy, dx) / (2*PI) + 0.5)), one of the rare cases where I actually had to work with angles instead of just vectors. This was being used for collision detection to figure out which part of the heightmap to check the object against, so performance was critical. However, any atan2() approximation I could find had too low precision, and in the case of my collision detection precision was so critical that the approximations caused missed collisions.
My point is that for any actual valid use of atan2() that you can’t use vectors for instead, you need very good precision. That being said, if we could find such an approximation I would make very good use of it.
That’s great news! Are these trade-offs done automatically by sollya or does it need manual tuning?
You have to make the choices about how to reduce the range. The tricky bit here is that they mostly involve division and java doesn’t give access to 1/x approximation operations.
Does the heightmap actually model a perturbed circle? If so there are options of doing something other than equi-angluar. That way you can move to a cheaper mapping function.
Sorry but it has already been moved into a module (jdk.unsupported) only accessible by using a switch:
http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/7b0b28ceca62/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
You’re right but have you looked at a replacement for Java 1.9 even though there is no hurry?
It is accessible without a switch or a module import when the runned Jar is not a Jigsaw module.
So, people can still use their application and JOML on JDK9 unchanged.
Once people actually decide to use Jigsaw to modularize their games, then we would have to modularize JOML as a Jigsaw module.
[quote]You’re right but have you looked at a replacement for Java 1.9 even though there is no hurry?
[/quote]
I will look at it once JDK9 is released and people start using it with Jigsaw.
Actually, no. You have to force this module to be exported, I had to use this even though I don’t package my software as a module:
[quote]–add-exports jdk.unsupported/jdk.internal.ref=ALL-UNNAMED
[/quote]
My guess is that you depend on Cleaner, which has been completely removed from sun.misc and moved to jdk.internal.ref. It has nothing to do with sun.misc.Unsafe.
[/quote]
I cannot reproduce. I am using this: https://jdk9.java.net/download/. What are you using?
Using the following test case:
import org.joml.Matrix4f;
public class Test {
public static void main(String[] args) {
Matrix4f m = new Matrix4f().zero().identity();
System.out.println(m);
}
}
and adding a sysout call to both the MemUtilNIO.identity() and the MemUtilUnsafe.identity(), show that the MemUtilUnsafe.identity() gets called and no class/module loading errors occur, when invoking java.exe like so:
“C:\Program Files\Java\jdk-9\bin\java.exe” -cp joml-1.9.0-SNAPSHOT.jar;bin/ Test
where bin/ contains the Eclipse-compiled Test class.
If you feel that there indeed is an issue, please open a GitHub issue with a reproducible test case.