Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
gfx::Vector2dF Class Reference

#include <vector2d_f.h>

Public Member Functions

constexpr Vector2dF ()
 
constexpr Vector2dF (float x, float y)
 
constexpr float x () const
 
void set_x (float x)
 
constexpr float y () const
 
void set_y (float y)
 
bool IsZero () const
 
void Add (const Vector2dF &other)
 
void Subtract (const Vector2dF &other)
 
void operator+= (const Vector2dF &other)
 
void operator-= (const Vector2dF &other)
 
void SetToMin (const Vector2dF &other)
 
void SetToMax (const Vector2dF &other)
 
double LengthSquared () const
 
float Length () const
 
void Scale (float scale)
 
void Scale (float x_scale, float y_scale)
 
std::string ToString () const
 

Detailed Description

Definition at line 21 of file vector2d_f.h.

Constructor & Destructor Documentation

◆ Vector2dF() [1/2]

constexpr gfx::Vector2dF::Vector2dF ( )
inlineconstexpr

Definition at line 23 of file vector2d_f.h.

23: x_(0), y_(0) {}

◆ Vector2dF() [2/2]

constexpr gfx::Vector2dF::Vector2dF ( float  x,
float  y 
)
inlineconstexpr

Definition at line 24 of file vector2d_f.h.

24: x_(x), y_(y) {}
constexpr float y() const
Definition vector2d_f.h:29
constexpr float x() const
Definition vector2d_f.h:26

Member Function Documentation

◆ Add()

void gfx::Vector2dF::Add ( const Vector2dF other)

Definition at line 21 of file vector2d_f.cc.

21 {
22 x_ += other.x_;
23 y_ += other.y_;
24}

◆ IsZero()

bool gfx::Vector2dF::IsZero ( ) const

Definition at line 17 of file vector2d_f.cc.

17 {
18 return x_ == 0 && y_ == 0;
19}

◆ Length()

float gfx::Vector2dF::Length ( ) const

Definition at line 35 of file vector2d_f.cc.

35 {
36 return static_cast<float>(std::sqrt(LengthSquared()));
37}
double LengthSquared() const
Definition vector2d_f.cc:31

◆ LengthSquared()

double gfx::Vector2dF::LengthSquared ( ) const

Definition at line 31 of file vector2d_f.cc.

31 {
32 return static_cast<double>(x_) * x_ + static_cast<double>(y_) * y_;
33}

◆ operator+=()

void gfx::Vector2dF::operator+= ( const Vector2dF other)
inline

Definition at line 40 of file vector2d_f.h.

40{ Add(other); }
void Add(const Vector2dF &other)
Definition vector2d_f.cc:21

◆ operator-=()

void gfx::Vector2dF::operator-= ( const Vector2dF other)
inline

Definition at line 41 of file vector2d_f.h.

41{ Subtract(other); }
void Subtract(const Vector2dF &other)
Definition vector2d_f.cc:26

◆ Scale() [1/2]

void gfx::Vector2dF::Scale ( float  scale)
inline

Definition at line 59 of file vector2d_f.h.

59{ Scale(scale, scale); }
const Scalar scale

◆ Scale() [2/2]

void gfx::Vector2dF::Scale ( float  x_scale,
float  y_scale 
)

Definition at line 39 of file vector2d_f.cc.

39 {
40 x_ *= x_scale;
41 y_ *= y_scale;
42}

◆ set_x()

void gfx::Vector2dF::set_x ( float  x)
inline

Definition at line 27 of file vector2d_f.h.

27{ x_ = x; }

◆ set_y()

void gfx::Vector2dF::set_y ( float  y)
inline

Definition at line 30 of file vector2d_f.h.

30{ y_ = y; }

◆ SetToMax()

void gfx::Vector2dF::SetToMax ( const Vector2dF other)
inline

Definition at line 48 of file vector2d_f.h.

48 {
49 x_ = x_ >= other.x_ ? x_ : other.x_;
50 y_ = y_ >= other.y_ ? y_ : other.y_;
51 }

◆ SetToMin()

void gfx::Vector2dF::SetToMin ( const Vector2dF other)
inline

Definition at line 43 of file vector2d_f.h.

43 {
44 x_ = x_ <= other.x_ ? x_ : other.x_;
45 y_ = y_ <= other.y_ ? y_ : other.y_;
46 }

◆ Subtract()

void gfx::Vector2dF::Subtract ( const Vector2dF other)

Definition at line 26 of file vector2d_f.cc.

26 {
27 x_ -= other.x_;
28 y_ -= other.y_;
29}

◆ ToString()

std::string gfx::Vector2dF::ToString ( ) const

Definition at line 13 of file vector2d_f.cc.

13 {
14 return base::StringPrintf("[%f %f]", x_, y_);
15}
std::string StringPrintf(const std::string &format, Args... args)

◆ x()

constexpr float gfx::Vector2dF::x ( ) const
inlineconstexpr

Definition at line 26 of file vector2d_f.h.

26{ return x_; }

◆ y()

constexpr float gfx::Vector2dF::y ( ) const
inlineconstexpr

Definition at line 29 of file vector2d_f.h.

29{ return y_; }

The documentation for this class was generated from the following files: