|
@@ -1,11 +1,6 @@
|
|
|
= Math Cheat Sheet
|
|
|
-:author:
|
|
|
-:revnumber:
|
|
|
-:revdate: 2016/03/17 20:48
|
|
|
-:relfileprefix: ../../
|
|
|
-:imagesdir: ../..
|
|
|
-ifdef::env-github,env-browser[:outfilesuffix: .adoc]
|
|
|
-
|
|
|
+:revnumber: 2.0
|
|
|
+:revdate: 2020/07/13
|
|
|
|
|
|
|
|
|
== Formulas
|
|
@@ -37,7 +32,7 @@ a|p0 = p1.add(v1)
|
|
|
a| direction, position and distance +
|
|
|
v1,p1,dist
|
|
|
a|Position at distance +
|
|
|
-p2
|
|
|
+p2
|
|
|
a|v1.normalzeLocal() +
|
|
|
scaledDir = v1.mult(dist) +
|
|
|
p2 = p1.add(scaledDir)
|
|
@@ -63,7 +58,7 @@ a|v0 = p1.substract(p2)
|
|
|
|
|
|
a|two points, a fraction +
|
|
|
p1, p2, h=0.5f
|
|
|
-a|the point “halfway (h=0.5f) between the two points +
|
|
|
+a|the point "`halfway`" (h=0.5f) between the two points +
|
|
|
new interpolated point p0
|
|
|
a|p0 = FastMath.interpolateLinear(h,p1,p2)
|
|
|
|
|
@@ -83,33 +78,33 @@ a|I want…
|
|
|
a|Formula
|
|
|
|
|
|
a|angle in degrees +
|
|
|
-a
|
|
|
+a
|
|
|
a| to convert angle a from degrees to radians +
|
|
|
new float angle phi
|
|
|
a|phi = a / 180 * FastMath.PI; +
|
|
|
OR +
|
|
|
-phi=a.mult(FastMath.DEG_TO_RAD);
|
|
|
+phi=a.mult(FastMath.DEG_TO_RAD);
|
|
|
|
|
|
a|angle in radians +
|
|
|
-phi
|
|
|
+phi
|
|
|
a| to convert angle phi from radians to degrees +
|
|
|
new float angle a
|
|
|
-a|a = phi * 180 / FastMath.PI
|
|
|
+a|a = phi * 180 / FastMath.PI
|
|
|
|
|
|
a|radian angle and x axis +
|
|
|
-phi, x
|
|
|
+phi, x
|
|
|
a|to rotate around x axis +
|
|
|
new quaternion q0
|
|
|
a|q0.fromAngleAxis( phi, Vector3f.UNIT_X )
|
|
|
|
|
|
a|radian angle and y axis +
|
|
|
-phi, y
|
|
|
+phi, y
|
|
|
a|to rotate around y axis +
|
|
|
new quaternion q0
|
|
|
a|q0.fromAngleAxis( phi, Vector3f.UNIT_Y )
|
|
|
|
|
|
a|radian angle and z axis +
|
|
|
-phi, z
|
|
|
+phi, z
|
|
|
a|to rotate around z axis +
|
|
|
new quaternion q0
|
|
|
a|q0.fromAngleAxis( phi, Vector3f.UNIT_Z )
|