mathlib: change RotateAboutZ to double
This commit is contained in:
parent
ceab425885
commit
7545119593
|
|
@ -138,7 +138,7 @@ qvec3f CosineWeightedHemisphereSample(float u1, float u2)
|
|||
qvec3f vec_from_mangle(const qvec3f &m)
|
||||
{
|
||||
const qvec3f mRadians = m * static_cast<float>(Q_PI / 180.0f);
|
||||
const qmat3x3f rotations = RotateAboutZ(mRadians[0]) * RotateAboutY(-mRadians[1]);
|
||||
const qmat3x3f rotations = qmat3x3f(RotateAboutZ(mRadians[0])) * RotateAboutY(-mRadians[1]);
|
||||
const qvec3f v = rotations * qvec3f(1,0,0);
|
||||
return v;
|
||||
}
|
||||
|
|
@ -189,12 +189,12 @@ qmat3x3f RotateAboutY(float t)
|
|||
};
|
||||
}
|
||||
|
||||
qmat3x3f RotateAboutZ(float t)
|
||||
qmat3x3d RotateAboutZ(double t)
|
||||
{
|
||||
const float cost = cos(t);
|
||||
const float sint = sin(t);
|
||||
const double cost = cos(t);
|
||||
const double sint = sin(t);
|
||||
|
||||
return qmat3x3f{
|
||||
return qmat3x3d{
|
||||
cost, sint, 0, // col0
|
||||
-sint, cost, 0, // col1
|
||||
0, 0, 1 //col2
|
||||
|
|
@ -218,7 +218,7 @@ qmat3x3f RotateFromUpToSurfaceNormal(const qvec3f &surfaceNormal)
|
|||
cosangleFromUp = qmin(qmax(-1.0f, cosangleFromUp), 1.0f);
|
||||
float radiansFromUp = acosf(cosangleFromUp);
|
||||
|
||||
const qmat3x3f rotations = RotateAboutZ(theta) * RotateAboutY(radiansFromUp);
|
||||
const qmat3x3f rotations = qmat3x3f(RotateAboutZ(theta)) * RotateAboutY(radiansFromUp);
|
||||
return rotations;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ qvec3f vec_from_mangle(const qvec3f &m);
|
|||
qvec3f mangle_from_vec(const qvec3f &v);
|
||||
qmat3x3f RotateAboutX(float t);
|
||||
qmat3x3f RotateAboutY(float t);
|
||||
qmat3x3f RotateAboutZ(float t);
|
||||
qmat3x3d RotateAboutZ(double t);
|
||||
qmat3x3f RotateFromUpToSurfaceNormal(const qvec3f &surfaceNormal);
|
||||
|
||||
bool AABBsDisjoint(const vec3_t minsA, const vec3_t maxsA, const vec3_t minsB, const vec3_t maxsB);
|
||||
|
|
@ -265,12 +265,23 @@ static inline qvec3f vec3_t_to_glm(const vec3_t vec) {
|
|||
return qvec3f(vec[0], vec[1], vec[2]);
|
||||
}
|
||||
|
||||
static inline qvec3d qvec3d_from_vec3(const vec3_t vec) {
|
||||
return qvec3d(vec[0], vec[1], vec[2]);
|
||||
}
|
||||
|
||||
static inline void glm_to_vec3_t(const qvec3f &glm, vec3_t out) {
|
||||
out[0] = glm[0];
|
||||
out[1] = glm[1];
|
||||
out[2] = glm[2];
|
||||
}
|
||||
|
||||
static inline void glm_to_vec3_t(const qvec3d &glm, vec3_t out) {
|
||||
out[0] = glm[0];
|
||||
out[1] = glm[1];
|
||||
out[2] = glm[2];
|
||||
}
|
||||
|
||||
|
||||
// Returns (0 0 0) if we couldn't determine the normal
|
||||
qvec3f GLM_FaceNormal(std::vector<qvec3f> points);
|
||||
std::pair<bool, qvec4f> GLM_MakeInwardFacingEdgePlane(const qvec3f &v0, const qvec3f &v1, const qvec3f &faceNormal);
|
||||
|
|
|
|||
Loading…
Reference in New Issue