11 namespace visualization {
22 float dist = r_at_mousedown_;
23 float sin_theta = std::sin(theta);
24 float cos_theta = std::cos(theta);
25 float sin_phi = std::sin(phi);
26 float cos_phi = std::cos(phi);
30 Eigen::Vector3f up(-cos_phi * sin_theta, -sin_phi * sin_theta, cos_theta);
32 Eigen::Vector3f left = up.cross(forward);
33 Camera::Transform::MatrixType mm;
34 mm << -left.x(), up.x(), -forward.x(), eye.x(), -left.y(), up.y(),
35 -forward.y(), eye.y(), -left.z(), up.z(), -forward.z(), eye.z(),
36 0.0f, 0.0f, 0.0f, 1.0f;
45 Eigen::Vector3f eye(m(0, 3), m(1, 3), m(2, 3));
46 Eigen::Vector3f up(m(0, 1), m(1, 1), m(2, 1));
55 theta_at_mousedown_ = std::asin(eye_z);
59 phi_at_mousedown_ = std::atan2(-up_y, -up_x);
61 phi_at_mousedown_ = std::atan2(eye_y, eye_x);
64 if (theta_at_mousedown_ > 0) {
65 theta_at_mousedown_ =
M_PI - theta_at_mousedown_;
67 theta_at_mousedown_ = -
M_PI - theta_at_mousedown_;
69 phi_at_mousedown_ += float(
M_PI);
void StartMouseDrag() override
void StartMouseDrag() override
void Rotate(int dx, int dy) override
CameraSphereInteractorLogic(Camera *c, double min_far_plane)
Eigen::Transform< float, 3, Eigen::Affine > Transform
virtual void SetModelMatrix(const Transform &view)=0
virtual Transform GetModelMatrix() const =0
void SetMatrix(const Camera::Transform &matrix)
Eigen::Vector3f center_of_rotation_
__host__ __device__ int2 abs(int2 v)
static double dist(double x1, double y1, double x2, double y2)
Generic file read and write utility for python interface.