Blender V4.3
blender::math::AngleCartesianBase< T > Struct Template Reference

#include <BLI_math_angle_types.hh>

Public Member Functions

 AngleCartesianBase ()=default
 
 AngleCartesianBase (const T &x, const T &y)
 
 AngleCartesianBase (const T &radian)
 
 AngleCartesianBase (const AngleRadianBase< T > &angle)
 
 operator T () const
 
T degree () const
 
T radian () const
 
T cos () const
 
T sin () const
 
T tan () const
 
AngleCartesianBaseoperator+= (const AngleCartesianBase &b)
 
AngleCartesianBaseoperator*= (const T &b)
 
AngleCartesianBaseoperator-= (const AngleCartesianBase &b)
 
AngleCartesianBaseoperator/= (const T &b)
 

Static Public Member Functions

static AngleCartesianBase identity ()
 
static AngleCartesianBase from_degree (const T &degrees)
 
static AngleCartesianBase from_point (const T &x, const T &y)
 

Friends

AngleCartesianBase operator+ (const AngleCartesianBase &a, const AngleCartesianBase &b)
 
AngleCartesianBase operator- (const AngleCartesianBase &a, const AngleCartesianBase &b)
 
AngleCartesianBase operator* (const AngleCartesianBase &a, const T &b)
 
AngleCartesianBase operator* (const T &b, const AngleCartesianBase &a)
 
AngleCartesianBase operator/ (const AngleCartesianBase &a, const T &divisor)
 
AngleCartesianBase operator- (const AngleCartesianBase &a)
 
std::ostream & operator<< (std::ostream &stream, const AngleCartesianBase &rot)
 

Detailed Description

template<typename T>
struct blender::math::AngleCartesianBase< T >

A blender::math::AngleCartesianBase<T> stores the angle as cosine + sine tuple.

  • Storage : 2 * sizeof(T)
  • Range : [-pi..pi]
  • Fast : cos(), sin(), tan(), AngleCartesian(cos, sin)
  • Slow : Everything not fast. It is only useful for intermediate representation when converting to other rotation types (eg: AxisAngle > Quaternion) and for creating rotations from 2D points. In general it offers an advantage when trigonometric values of an angle are required but not directly the angle itself. It is also a nice shortcut for using the trigonometric identities.

Definition at line 167 of file BLI_math_angle_types.hh.

Constructor & Destructor Documentation

◆ AngleCartesianBase() [1/4]

◆ AngleCartesianBase() [2/4]

template<typename T >
blender::math::AngleCartesianBase< T >::AngleCartesianBase ( const T & x,
const T & y )
inline

Create an angle from a (x, y) position on the unit circle.

Definition at line 178 of file BLI_math_angle_types.hh.

References blender::math::abs(), BLI_assert, e, and T.

◆ AngleCartesianBase() [3/4]

template<typename T >
blender::math::AngleCartesianBase< T >::AngleCartesianBase ( const T & radian)
inlineexplicit

Create an angle from a radian value.

Definition at line 186 of file BLI_math_angle_types.hh.

◆ AngleCartesianBase() [4/4]

template<typename T >
blender::math::AngleCartesianBase< T >::AngleCartesianBase ( const AngleRadianBase< T > & angle)
inlineexplicit

Definition at line 188 of file BLI_math_angle_types.hh.

Member Function Documentation

◆ cos()

template<typename T >
T blender::math::AngleCartesianBase< T >::cos ( ) const
inline

◆ degree()

template<typename T >
T blender::math::AngleCartesianBase< T >::degree ( ) const
inline

Definition at line 225 of file BLI_math_angle_types.hh.

References blender::math::numbers::pi, and T.

◆ from_degree()

template<typename T >
static AngleCartesianBase blender::math::AngleCartesianBase< T >::from_degree ( const T & degrees)
inlinestatic

◆ from_point()

template<typename T >
static AngleCartesianBase blender::math::AngleCartesianBase< T >::from_point ( const T & x,
const T & y )
inlinestatic

Create an angle from a (x, y) position on the 2D plane. Fallback to identity if (x, y) is origin (0, 0).

Definition at line 207 of file BLI_math_angle_types.hh.

References blender::math::AngleCartesianBase< T >::AngleCartesianBase(), blender::math::AngleCartesianBase< T >::identity(), norm(), and blender::math::sqrt().

Referenced by blender::math::QuaternionBase< T >::twist().

◆ identity()

template<typename T >
static AngleCartesianBase blender::math::AngleCartesianBase< T >::identity ( )
inlinestatic

Static functions.

Definition at line 193 of file BLI_math_angle_types.hh.

Referenced by blender::math::AngleCartesianBase< T >::from_point().

◆ operator T()

template<typename T >
blender::math::AngleCartesianBase< T >::operator T ( ) const
inlineexplicit

Conversions.

Definition at line 219 of file BLI_math_angle_types.hh.

References blender::math::atan2().

◆ operator*=()

template<typename T >
AngleCartesianBase & blender::math::AngleCartesianBase< T >::operator*= ( const T & b)
inline

Definition at line 326 of file BLI_math_angle_types.hh.

References b.

◆ operator+=()

template<typename T >
AngleCartesianBase & blender::math::AngleCartesianBase< T >::operator+= ( const AngleCartesianBase< T > & b)
inline

Definition at line 320 of file BLI_math_angle_types.hh.

References b.

◆ operator-=()

template<typename T >
AngleCartesianBase & blender::math::AngleCartesianBase< T >::operator-= ( const AngleCartesianBase< T > & b)
inline

Definition at line 332 of file BLI_math_angle_types.hh.

References b.

◆ operator/=()

template<typename T >
AngleCartesianBase & blender::math::AngleCartesianBase< T >::operator/= ( const T & b)
inline

Definition at line 338 of file BLI_math_angle_types.hh.

References b.

◆ radian()

template<typename T >
T blender::math::AngleCartesianBase< T >::radian ( ) const
inline

Definition at line 231 of file BLI_math_angle_types.hh.

References T.

◆ sin()

template<typename T >
T blender::math::AngleCartesianBase< T >::sin ( ) const
inline

◆ tan()

template<typename T >
T blender::math::AngleCartesianBase< T >::tan ( ) const
inline

Definition at line 248 of file BLI_math_angle_types.hh.

Friends And Related Symbol Documentation

◆ operator* [1/2]

template<typename T >
AngleCartesianBase operator* ( const AngleCartesianBase< T > & a,
const T & b )
friend

Definition at line 275 of file BLI_math_angle_types.hh.

◆ operator* [2/2]

template<typename T >
AngleCartesianBase operator* ( const T & b,
const AngleCartesianBase< T > & a )
friend

Definition at line 290 of file BLI_math_angle_types.hh.

◆ operator+

template<typename T >
AngleCartesianBase operator+ ( const AngleCartesianBase< T > & a,
const AngleCartesianBase< T > & b )
friend

Operators. NOTE: These use the trigonometric identities: https://en.wikipedia.org/wiki/List_of_trigonometric_identities (see Angle_sum_and_difference_identities, Multiple-angle_formulae and Half-angle_formulae)

There are no identities for (arbitrary) product or quotient of angles. Better leave these unimplemented to avoid accidentally using atan everywhere (which is the purpose of this class).

Definition at line 265 of file BLI_math_angle_types.hh.

◆ operator- [1/2]

template<typename T >
AngleCartesianBase operator- ( const AngleCartesianBase< T > & a)
friend

Definition at line 315 of file BLI_math_angle_types.hh.

◆ operator- [2/2]

template<typename T >
AngleCartesianBase operator- ( const AngleCartesianBase< T > & a,
const AngleCartesianBase< T > & b )
friend

Definition at line 270 of file BLI_math_angle_types.hh.

◆ operator/

template<typename T >
AngleCartesianBase operator/ ( const AngleCartesianBase< T > & a,
const T & divisor )
friend

Definition at line 295 of file BLI_math_angle_types.hh.

◆ operator<<

template<typename T >
std::ostream & operator<< ( std::ostream & stream,
const AngleCartesianBase< T > & rot )
friend

Definition at line 346 of file BLI_math_angle_types.hh.


The documentation for this struct was generated from the following file: