// set camera position, aim, up. Verify, and make up the true up direction void GraphicCamera::GetCoordinate(const Vec3d& pos, const Vec3d& aim, const Vec3d& up){ Vec3d zaixs = pos - aim; if (zaixs.Norm() < kEPSILON) { throw "Camera position and aim are the same. Problematic"; exit(1); } Vec3d dir = -zaixs.Normalization(); Vec3d _up = up.Normalization(); Vec3d xaxis = dir % _up; if (xaxis.Norm() < kEPSILON ) { throw "Up parallel to aim. Wrong parameter"; } this->pos_ = pos; this->aim_ = aim; this->up_ = xaxis.Normalization() % dir; // make it always perpendicular // to dir }