https://github.com/lsw9021/DexterousManipulation
Raw File
Tip revision: 11269e20e5283c3f31b6ce1ea9a4805c8bdeecac authored by Lee Seung Hwan on 07 October 2021, 05:40:43 UTC
Create LICENSE
Tip revision: 11269e2
Camera.h
#ifndef __GUI_CAMERA_H__
#define __GUI_CAMERA_H__
#include <Eigen/Core>
#include <Eigen/Sparse>
#include <Eigen/Geometry>

namespace GUI
{
class Camera
{
public:
	Camera();
		
	void SetCamera(const Eigen::Vector3d& lookAt,const Eigen::Vector3d& eye,const Eigen::Vector3d& up);
	void Apply();

	void Pan(int x,int y,int prev_x,int prev_y);
	void Zoom(int x,int y,int prev_x,int prev_y);
	void Rotate(int x,int y,int prev_x,int prev_y);
	void Translate(int x,int y,int prev_x,int prev_y);

private:
	Eigen::Vector3d lookAt;
	Eigen::Vector3d eye;
	Eigen::Vector3d up;
	double fovy;

	Eigen::Vector3d Rotateq(const Eigen::Vector3d& target, const Eigen::Vector3d& rotateVector,double angle);
	Eigen::Vector3d GetTrackballPoint(int mouseX, int mouseY,int w,int h);
	Eigen::Vector3d UnProject(const Eigen::Vector3d& vec);
};

};

#endif
back to top