|
Colobot
|
2D point More...
#include <src/math/point.h>
Public Member Functions | |
| Point () | |
| Constructs a zero point: (0,0) More... | |
| Point (float _x, float _y) | |
| Constructs a point from given coords: (x,y) More... | |
| void | LoadZero () |
| Sets the zero point: (0,0) More... | |
| float * | Array () |
Returns the struct cast to float* array; use with care! More... | |
| const float * | Array () const |
Returns the struct cast to const float* array; use with care! More... | |
| float | Length () |
| Returns the distance from (0,0) to the point (x,y) More... | |
| Point | operator- () const |
| Returns the inverted point. More... | |
| const Point & | operator+= (const Point &right) |
| Adds the given point. More... | |
| const Point & | operator-= (const Point &right) |
| Subtracts the given point. More... | |
| const Point & | operator*= (const float &right) |
| Multiplies by given scalar. More... | |
| const Point & | operator/= (const float &right) |
| Divides by given scalar. More... | |
| std::string | ToString () const |
| Returns a string "[x, y]". More... | |
Public Attributes | |
| float | x |
| X coord. More... | |
| float | y |
| Y coord. More... | |
Friends | |
| const friend Point | operator+ (const Point &left, const Point &right) |
| Adds two points. More... | |
| const friend Point | operator- (const Point &left, const Point &right) |
| Subtracts two points. More... | |
| const friend Point | operator* (const float &left, const Point &right) |
| Multiplies point by scalar. More... | |
| const friend Point | operator* (const Point &left, const float &right) |
| Multiplies point by scalar. More... | |
| const friend Point | operator/ (const Point &left, const float &right) |
| Divides point by scalar. More... | |
2D point
Represents a 2D point (x, y). Contains the required methods for operating on points.
All methods are made inline to maximize optimization.
|
inline |
Constructs a zero point: (0,0)
|
inlineexplicit |
Constructs a point from given coords: (x,y)
|
inline |
Sets the zero point: (0,0)
|
inline |
Returns the struct cast to float* array; use with care!
|
inline |
Returns the struct cast to const float* array; use with care!
|
inline |
Returns the distance from (0,0) to the point (x,y)
|
inline |
Returns the inverted point.
|
inline |
Multiplies by given scalar.
|
inline |
Divides by given scalar.
|
inline |
Returns a string "[x, y]".
Subtracts two points.
Multiplies point by scalar.
Multiplies point by scalar.
Divides point by scalar.
| float Math::Point::x |
X coord.
| float Math::Point::y |
Y coord.
1.8.16