Img2Num C++ (Internal Developer Docs) dev
API Documentation
Loading...
Searching...
No Matches
Point Struct Reference
+ Collaboration diagram for Point:

Public Member Functions

Point operator+ (const Point &other) const
 
Point operator- (const Point &other) const
 
Point operator* (float scalar) const
 
Point operator/ (float scalar) const
 
Pointoperator+= (const Point &other)
 

Static Public Member Functions

static float distSq (Point a, Point b)
 

Public Attributes

float x = 0
 
float y = 0
 

Friends

Point operator* (float scalar, const Point &v)
 

Detailed Description

Definition at line 5 of file Point.h.

Member Function Documentation

◆ distSq()

static float Point::distSq ( Point  a,
Point  b 
)
inlinestatic

Definition at line 40 of file Point.h.

40 {
41 return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
42 }

◆ operator*()

Point Point::operator* ( float  scalar) const
inline

Definition at line 20 of file Point.h.

20 {
21 return Point{x * scalar, y * scalar};
22 }
Definition Point.h:5

◆ operator+()

Point Point::operator+ ( const Point other) const
inline

Definition at line 9 of file Point.h.

9 {
10 return Point{x + other.x, y + other.y};
11 }

◆ operator+=()

Point & Point::operator+= ( const Point other)
inline

Definition at line 34 of file Point.h.

34 {
35 x += other.x;
36 y += other.y;
37 return *this;
38 }

◆ operator-()

Point Point::operator- ( const Point other) const
inline

Definition at line 14 of file Point.h.

14 {
15 return Point{x - other.x, y - other.y};
16 }

◆ operator/()

Point Point::operator/ ( float  scalar) const
inline

Definition at line 24 of file Point.h.

24 {
25 return Point{x / scalar, y / scalar};
26 }

Friends And Related Symbol Documentation

◆ operator*

Point operator* ( float  scalar,
const Point v 
)
friend

Definition at line 29 of file Point.h.

29 {
30 return Point{v.x * scalar, v.y * scalar};
31 ; // Calls the member function for the actual logic
32 }

Member Data Documentation

◆ x

float Point::x = 0

Definition at line 6 of file Point.h.

◆ y

float Point::y = 0

Definition at line 7 of file Point.h.


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