Exemple #1
0
	/// Near-equality comparison
	friend bool Close(const Quaternion& q1, const Quaternion& q2, T eps)
	{
		for(std::size_t i=0; i!=4; ++i)
		{
			T u = q1.At(i);
			T v = q2.At(i);
			T d = std::abs(u-v);
			bool ca = d <= std::abs(u)*eps;
			bool cb = d <= std::abs(v)*eps;
			if(!ca && !cb) return false;
		}
		return true;
	}