Home Libraries People FAQ More

### quaternion 類模板

```namespace boost{ namespace math{

template<typename T>
class quaternion
{
public:

typedef T value_type;

explicit quaternion(T const & requested_a = T(), T const & requested_b = T(), T const & requested_c = T(), T const & requested_d = T());
explicit quaternion(::std::complex<T> const & z0, ::std::complex<T> const & z1 = ::std::complex<T>());
template<typename X>
explicit quaternion(quaternion<X> const & a_recopier);

T                  real() const;
quaternion<T>      unreal() const;
T                  R_component_1() const;
T                  R_component_2() const;
T                  R_component_3() const;
T                  R_component_4() const;
::std::complex<T>  C_component_1() const;
::std::complex<T>  C_component_2() const;

quaternion<T>&     operator = (quaternion<T> const  & a_affecter);
template<typename X>
quaternion<T>&     operator = (quaternion<X> const  & a_affecter);
quaternion<T>&     operator = (T const  & a_affecter);
quaternion<T>&     operator = (::std::complex<T> const & a_affecter);

quaternion<T>&     operator += (T const & rhs);
quaternion<T>&     operator += (::std::complex<T> const & rhs);
template<typename X>
quaternion<T>&     operator += (quaternion<X> const & rhs);

quaternion<T>&     operator -= (T const & rhs);
quaternion<T>&     operator -= (::std::complex<T> const & rhs);
template<typename X>
quaternion<T>&     operator -= (quaternion<X> const & rhs);

quaternion<T>&     operator *= (T const & rhs);
quaternion<T>&     operator *= (::std::complex<T> const & rhs);
template<typename X>
quaternion<T>&     operator *= (quaternion<X> const & rhs);

quaternion<T>&     operator /= (T const & rhs);
quaternion<T>&     operator /= (::std::complex<T> const & rhs);
template<typename X>
quaternion<T>&     operator /= (quaternion<X> const & rhs);
};

} // namespace math
} // namespace boost
```