+ private static final int DIMS = 3;
+
+ /*
+ * cache the most used rotations: +/- 1, 2, 3, 4 degrees around x or y axis
+ */
+ private static Map<Axis, Map<Float, float[][]>> cachedRotations;
+
+ static
+ {
+ cachedRotations = new HashMap<>();
+ for (Axis axis : Axis.values())
+ {
+ HashMap<Float, float[][]> map = new HashMap<>();
+ cachedRotations.put(axis, map);
+ for (int deg = 1; deg < 5; deg++)
+ {
+ float[][] rotation = getRotation(deg, axis);
+ map.put(Float.valueOf(deg), rotation);
+ rotation = getRotation(-deg, axis);
+ map.put(Float.valueOf(-deg), rotation);
+ }
+ }
+ }