Index: chrome/browser/android/vr_shell/vr_math.h |
diff --git a/chrome/browser/android/vr_shell/vr_math.h b/chrome/browser/android/vr_shell/vr_math.h |
index 4b520c293ac81272be87a30f96fdbafa9f656340..97904086fd7ae6af985166f37d2265a6639181e6 100644 |
--- a/chrome/browser/android/vr_shell/vr_math.h |
+++ b/chrome/browser/android/vr_shell/vr_math.h |
@@ -42,11 +42,20 @@ typedef struct Colorf { |
} Colorf; |
void SetIdentityM(gvr::Mat4f& mat); |
+// Left multiply a translation matrix. |
void TranslateM(gvr::Mat4f& tmat, gvr::Mat4f& mat, float x, float y, float z); |
+// Left multiply a scale matrix. |
void ScaleM(gvr::Mat4f& tmat, const gvr::Mat4f& mat, float x, float y, float z); |
+float Clampf(float value, float min, float max); |
+float ToDegrees(float radians); |
+ |
+// Spherical Linear Interpolation |
cjgrant
2017/04/03 19:25:00
// Spherical linear interpolation.
acondor_
2017/04/19 18:44:27
Done.
|
+gvr::Vec3f QuatSlerp(gvr::Vec3f start, gvr::Vec3f end, float percent); |
cjgrant
2017/04/03 19:25:00
Pass start and end by const&?
acondor_
2017/04/19 18:44:27
Done.
|
+ |
// Util functions that are copied from the treasure_hunt NDK demo in |
// third_party/gvr-andoir-sdk/ folder. |
+// Rotation only, ignore translation components. |
gvr::Vec3f MatrixVectorMul(const gvr::Mat4f& m, const gvr::Vec3f& v); |
gvr::Vec3f MatrixVectorRotate(const gvr::Mat4f& m, const gvr::Vec3f& v); |
gvr::Mat4f MatrixMul(const gvr::Mat4f& matrix1, const gvr::Mat4f& matrix2); |
@@ -61,16 +70,30 @@ gvr::Vec3f GetTranslation(const gvr::Mat4f& matrix); |
gvr::Mat4f QuatToMatrix(const gvr::Quatf& quat); |
+float VectorLengthSquared(const gvr::Vec3f& vec); |
float VectorLength(const gvr::Vec3f& vec); |
gvr::Vec3f VectorSubtract(const gvr::Vec3f& a, const gvr::Vec3f& b); |
+gvr::Vec3f VectorAdd(const gvr::Vec3f& a, const gvr::Vec3f& b); |
cjgrant
2017/04/03 19:25:00
If you're adding comments to methods above, certai
acondor_
2017/04/19 18:44:27
Done.
|
float VectorDot(const gvr::Vec3f& a, const gvr::Vec3f& b); |
+gvr::Vec3f VectorCross(const gvr::Vec3f& a, const gvr::Vec3f& b); |
+gvr::Vec3f PointwiseVectorMul(const gvr::Vec3f& a, const gvr::Vec3f& b); |
+gvr::Vec3f VectorScalarMul(const gvr::Vec3f& a, float s); |
+float VectorAngleDegrees(const gvr::Vec3f& a, const gvr::Vec3f& b); |
// Normalize a vector, and return its original length. |
float NormalizeVector(gvr::Vec3f& vec); |
void NormalizeQuat(gvr::Quatf& quat); |
+gvr::Quatf QuatMultiply(const gvr::Quatf& a, const gvr::Quatf& b); |
+gvr::Quatf QuatAdd(const gvr::Quatf& a, const gvr::Quatf& b); |
+gvr::Quatf QuatScalarMul(const gvr::Quatf& quat, float s); |
+gvr::Quatf QuatInverted(const gvr::Quatf& quat); |
+float QuatAngleDegrees(const gvr::Quatf& a, const gvr::Quatf& b); |
+gvr::Quatf QuatLerp(const gvr::Quatf& a, const gvr::Quatf& b, float t); |
+ |
gvr::Quatf QuatFromAxisAngle(const gvr::Vec3f& axis, float angle); |
+gvr::Quatf FromToRotation(const gvr::Vec3f& from, const gvr::Vec3f& to); |
cjgrant
2017/04/03 19:25:00
From the name, I have no idea what this method doe
acondor_
2017/04/19 18:44:27
Done.
|
gvr::Vec3f GetRayPoint(const gvr::Vec3f& rayOrigin, |
const gvr::Vec3f& rayVector, |