6#include <glm/gtc/matrix_transform.hpp>
7#include <glm/gtx/rotate_vector.hpp>
43 Vec3f ND = p - tarPos;
56 mYaw = -atan2f(ND.dot(right), ND.dot(view));
78 mYaw = -atan2f(ND.dot(right), ND.dot(view));
83 float newYaw =
mYaw + dx;
84 float newPitch =
mPitch + dy;
87 oldQuat.
w = -oldQuat.
w;
119 right = view.cross(up);
130 mEyePos += translation[0] * xax +
131 translation[1] * yax +
132 translation[2] * zax;
140 oldQuat.
w = -oldQuat.
w;
148 float frac = (logDist - logMax) / (logMax - logMin);
157 float t = 0.5f * 1 * 1;
171 if ((x1 == x2) && (y1 == y2)) {
176 Vec3f rotaxis = pos1.cross(pos2);
178 float rotangle = 2 *
sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
179 return Quat1f(rotangle, rotaxis);
217 glm::mat4 projection;
226 projection = glm::ortho(-half_depth * aspect, half_depth * aspect, -half_depth, half_depth, -5.0f * half_depth, 5.0f* half_depth);
238 float dx = tx -
mRegX;
239 float dy = ty -
mRegY;
250 float dx = tx -
mRegX;
251 float dy = ty -
mRegY;
void setClipFar(float zFar)
ProjectionType mProjectionType
glm::mat4 getViewMat() override
void getCoordSystem(Vec3f &view, Vec3f &up, Vec3f &right) const
Vec3f getPosition(float x, float y)
Vec3f getEyePos() const override
void rotateToPoint(float x, float y) override
void translate(const Vec3f translation)
glm::mat4 getProjMat() override
void zoom(float amount) override
void translateToPoint(float x, float y) override
void registerPoint(float x, float y) override
void setTargetPos(const Vec3f &p) override
void setEyePos(const Vec3f &p) override
void rotate(float dx, float dy)
Vec3f getTargetPos() const override
Quat1f getQuaternion(float x1, float y1, float x2, float y2)
DYN_FUNC void toRotationAxis(Real &rot, Vector< Real, 3 > &axis) const
DYN_FUNC Vector< Real, 3 > rotate(const Vector< Real, 3 > &v) const
Rotate a vector by the quaternion, guarantee the quaternion is normalized before rotating the vector.
This is an implementation of AdditiveCCD based on peridyno.
DYN_FUNC Complex< Real > sqrt(const Complex< Real > &)