コード例 #1
0
ファイル: ScanSequence.cpp プロジェクト: Guokr1991/OpenBCSim
Scanline::Scanline(const vector3& origin, const vector3& direction, const vector3& lateral_dir, float timestamp) :
    origin(origin), direction(direction), lateral_dir(lateral_dir), timestamp(timestamp) {

    elevational_dir = lateral_dir.cross(direction); 

    // TODO: Should all vectors be normalized here?

    if (!is_orthogonal()) throw std::runtime_error("Invalid Scanline: Not orthogonal unit vectors");
    if (!is_normalized()) throw std::runtime_error("Invalid Scanline: Not unit length vectors");
}
コード例 #2
0
vector3<float> get_rotation_axis(vector3<float> u, vector3<float> v) {
	u.normalize();
	v.normalize();
	// fix linear case
	if (u == v || u == -v) {
		v[0] += 0.1;
		v[1] += 0.0;
		v[2] += 0.1;
		v.normalize();
	}
	return u.cross(v);
}