| Flutter Impeller |

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. More...
| Trig (double cos, double sin)
| Construct a Trig object from the given cosine and sine values. More...
Vector2 | operator* (double radius) const
| Returns the corresponding point on a circle of a given |radius|. More...
Vector2 | operator* (const Size &ellipse_radii) const
| Returns the corresponding point on an ellipse with the given size. More...

## 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 | ) |
| inline explicit

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)) {}
impeller::Trig::cos
double cos
Definition: trig.h:24
impeller::Trig::sin
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 }
impeller::Vector2
Point Vector2
Definition: point.h:331
impeller::Scalar
float Scalar
Definition: scalar.h:18

References cos, impeller::TSize< T >::height, sin, and impeller::TSize< T >::width.

## ◆ 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 }

References cos, and sin.

## Member Data Documentation

## ◆ cos

double impeller::Trig::cos

Definition at line 24 of file trig.h.

Referenced by operator*(), and impeller::testing::TEST().

## ◆ sin

double impeller::Trig::sin

Definition at line 25 of file trig.h.

Referenced by operator*(), and impeller::testing::TEST().

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

- impeller/geometry/trig.h