Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
impeller::Trig Struct Reference

A structure to store the sine and cosine of an angle. More...

#include <trig.h>

Public Member Functions

 Trig (Radians r)
 Construct a Trig object from a given angle in radians.
 
 Trig (double cos, double sin)
 Construct a Trig object from the given cosine and sine values.
 
Vector2 operator* (double radius) const
 Returns the corresponding point on a circle of a given |radius|.
 
Vector2 operator* (const Size &ellipse_radii) const
 Returns the corresponding point on an ellipse with the given size.
 

Public Attributes

double cos
 
double sin
 

Detailed Description

A structure to store the sine and cosine of an angle.

Definition at line 16 of file trig.h.

Constructor & Destructor Documentation

◆ Trig() [1/2]

impeller::Trig::Trig ( Radians  r)
inlineexplicit

Construct a Trig object from a given angle in radians.

Definition at line 18 of file trig.h.

19 : cos(std::cos(r.radians)), sin(std::sin(r.radians)) {}
double cos
Definition trig.h:24
double sin
Definition trig.h:25

◆ Trig() [2/2]

impeller::Trig::Trig ( double  cos,
double  sin 
)
inline

Construct a Trig object from the given cosine and sine values.

Definition at line 22 of file trig.h.

22: cos(cos), sin(sin) {}

Member Function Documentation

◆ operator*() [1/2]

Vector2 impeller::Trig::operator* ( const Size ellipse_radii) const
inline

Returns the corresponding point on an ellipse with the given size.

Definition at line 34 of file trig.h.

34 {
35 return Vector2(static_cast<Scalar>(cos * ellipse_radii.width),
36 static_cast<Scalar>(sin * ellipse_radii.height));
37 }
Point Vector2
Definition point.h:320
float Scalar
Definition scalar.h:18

◆ operator*() [2/2]

Vector2 impeller::Trig::operator* ( double  radius) const
inline

Returns the corresponding point on a circle of a given |radius|.

Definition at line 28 of file trig.h.

28 {
29 return Vector2(static_cast<Scalar>(cos * radius),
30 static_cast<Scalar>(sin * radius));
31 }

Member Data Documentation

◆ cos

double impeller::Trig::cos

Definition at line 24 of file trig.h.

◆ sin

double impeller::Trig::sin

Definition at line 25 of file trig.h.


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