Example #1
0
void Camera::setView(PV3D* eye, PV3D* look, PV3D* up){
	this->eye = eye;
	this->look = look;
	this->up = up;

	setCoordSystem();
}
Example #2
0
void Camera::rotateY(GLdouble alpha){
	GLdouble eye_y = eye->y;
	eye->minus(new PV3D(0,eye_y,0));
	
	GLdouble x_ = eye->x*cos(alpha) - eye->z*sin(alpha);
	GLdouble z_ = eye->x*sin(alpha) + eye->z*cos(alpha);

	eye = new PV3D(x_, eye_y, z_);
	setCoordSystem();
	view();
}
Example #3
0
void Camera::rotateX(GLdouble alpha){
	GLdouble eye_x = eye->x;
	eye->minus(new PV3D(eye_x,0,0));
	
	GLdouble y_ = eye->y*cos(alpha) - eye->z*sin(alpha);
	GLdouble z_ = eye->y*sin(alpha) + eye->z*cos(alpha);

	eye = new PV3D(eye_x, y_, z_);
	setCoordSystem();
	view();
}
Example #4
0
void Camera::rotateZ(GLdouble alpha){
	GLdouble eye_z = eye->z;
	eye->minus(new PV3D(0,0,eye_z));
	
	GLdouble x_ = eye->x*cos(alpha) - eye->y*sin(alpha);
	GLdouble y_ = eye->x*sin(alpha) + eye->y*cos(alpha);

	eye = new PV3D(x_, y_, eye_z);
	setCoordSystem();
	view();
}
Example #5
0
Camera::Camera(PV3D* eye, PV3D* look, PV3D* up){
	
	setView(eye,look,up);
	setCoordSystem();

	// Camera set up
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluLookAt(eye->x, eye->y, eye->z, look->x, look->y, look->z, up->x, up->y, up->z);

	// Viewing frustum parameters
	vv_right = 5; vv_left = -vv_right; 
	vv_top = 5; vv_bottom = -vv_top;
	vv_near = 1; vv_far = 1000;
	vv_aspect = (vv_right - vv_left)/(vv_top - vv_bottom);


	// Frustum set up
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();     
	glOrtho(vv_left, vv_right, vv_bottom, vv_top, vv_near, vv_far);
}
Example #6
0
Matrix2d::Matrix2d(const Vector2d& e0, const Vector2d& e1, const Point2d& origin)
{
    setCoordSystem(e0, e1, origin);
}