Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1290)

Unified Diff: device/vr/vr_math.h

Issue 2795793002: Implementation of elbow model for the controller position and rotation. (Closed)
Patch Set: Rebasing. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/vr/vr_math.h
diff --git a/device/vr/vr_math.h b/device/vr/vr_math.h
index 2426b3dccfd1b672bd5c9ceb7235794c4a736422..a2ebe47617ae7a655d59068a0dcc3eb7f3e4e4bc 100644
--- a/device/vr/vr_math.h
+++ b/device/vr/vr_math.h
@@ -33,6 +33,27 @@ gfx::Vector3dF DEVICE_VR_EXPORT GetTranslation(const Mat4f& matrix);
void DEVICE_VR_EXPORT QuatToMatrix(const Quatf& quat, Mat4f* out);
+// Creates a rotation which rotates `from` vector to `to`.
+vr::Quatf DEVICE_VR_EXPORT GetVectorRotation(const gfx::Vector3dF& from,
+ const gfx::Vector3dF& to);
+
+vr::Quatf DEVICE_VR_EXPORT QuatSum(const vr::Quatf& a, const vr::Quatf& b);
+vr::Quatf DEVICE_VR_EXPORT QuatProduct(const vr::Quatf& a, const vr::Quatf& b);
+vr::Quatf DEVICE_VR_EXPORT ScaleQuat(const vr::Quatf& q, float s);
+
+vr::Quatf DEVICE_VR_EXPORT InvertedQuat(const vr::Quatf& quat);
mthiesse 2017/04/26 17:46:48 nit: InvertQuat
acondor_ 2017/04/26 18:42:26 Done.
+
+float DEVICE_VR_EXPORT QuatAngleDegrees(const vr::Quatf& a, const vr::Quatf& b);
+
+vr::Quatf DEVICE_VR_EXPORT QuatLerp(const vr::Quatf& a,
+ const vr::Quatf& b,
+ float t);
+
+// Spherical linear interpolation.
+gfx::Vector3dF DEVICE_VR_EXPORT QuatSlerp(const gfx::Vector3dF& v_start,
+ const gfx::Vector3dF& v_end,
+ float percent);
+
// Normalize a vector, and return its original length.
float DEVICE_VR_EXPORT NormalizeVector(gfx::Vector3dF* vec);
@@ -49,6 +70,20 @@ bool DEVICE_VR_EXPORT XZAngle(const gfx::Vector3dF& vec1,
const gfx::Vector3dF& vec2,
float* angle);
+gfx::Vector3dF DEVICE_VR_EXPORT ToVector(const gfx::Point3F& p);
+
+gfx::Point3F DEVICE_VR_EXPORT ToPoint(const gfx::Vector3dF& p);
+
+// Scale components of the point by the components of the vector.
+gfx::Point3F DEVICE_VR_EXPORT ScalePoint(const gfx::Point3F& p,
+ const gfx::Vector3dF& s);
+
+// Scale components of a vector by the components of another.
+gfx::Vector3dF DEVICE_VR_EXPORT ScaleVector(const gfx::Vector3dF& p,
+ const gfx::Vector3dF& s);
+
+float DEVICE_VR_EXPORT Clampf(float value, float min, float max);
+
} // namespace vr
#endif // DEVICE_VR_VR_MATH_H_

Powered by Google App Engine
This is Rietveld 408576698