+float HALF_OF_ONE_OVER_SQRT2_MINUS_1 = (1./sqrt(2) - 1) / 2;
+float HALF_OF_ONE_OVER_SQRT2_PLUS_1 = (1./sqrt(2) + 1) / 2;
+float SQRT2 = sqrt(2);
+
+/** Equivalent to rotate3d(c, a, 0, 0); */
+void rotate3dA(LXVector c, float a) {
+ float ox = c.x, oy = c.y;
+ float cosa = cos(a);
+ float sina = sin(a);
+ c.x = ox * cosa - oy * sina;
+ c.y = ox * sina + oy * cosa;
+}
+/** Equivalent to rotate3d(c, 0, b, 0); */
+void rotate3dB(LXVector c, float b) {
+ float ox = c.x, oz = c.z;
+ float cosb = cos(b);
+ float sinb = sin(b);
+ c.x = ox * cosb + oz * sinb;
+ c.z = oz * cosb - ox * sinb;
+}
+/** Equivalent to rotate3d(c, 0, 0, g); */
+void rotate3dG(LXVector c, float g) {
+ float oy = c.y, oz = c.z;
+ float cosg = cos(g);
+ float sing = sin(g);
+ c.y = oy * cosg - oz * sing;
+ c.z = oz * cosg + oy * sing;
+}
+/** Equivalent to rotate3d(c, PI/4, PI/4, PI/4); */
+void rotate3dPiOver4(LXVector c) {
+ float ox = c.x, oy = c.y, oz = c.z;
+ c.x = ox / 2 + oy * HALF_OF_ONE_OVER_SQRT2_MINUS_1 + oz * HALF_OF_ONE_OVER_SQRT2_PLUS_1;
+ c.y = ox / 2 + oy * HALF_OF_ONE_OVER_SQRT2_PLUS_1 + oz * HALF_OF_ONE_OVER_SQRT2_MINUS_1;
+ c.z = - ox / SQRT2 + oy / 2 + oz / 2;
+}
+
+void rotate3d(LXVector c, float a /* roll */, float b /* pitch */, float g /* yaw */) {
+ float ox = c.x, oy = c.y, oz = c.z;
+