Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Public Attributes | Friends | List of all members
Math::Point Struct Reference

2D point More...

#include <point.h>

Public Member Functions

 Point ()
 Constructs a zero point: (0,0)
 
 Point (float _x, float _y)
 Constructs a point from given coords: (x,y)
 
void LoadZero ()
 Sets the zero point: (0,0)
 
float * Array ()
 Returns the struct cast to float* array; use with care!
 
const float * Array () const
 Returns the struct cast to const float* array; use with care!
 
float Length ()
 Returns the distance from (0,0) to the point (x,y)
 
Point operator- () const
 Returns the inverted point.
 
const Pointoperator+= (const Point &right)
 Adds the given point.
 
const Pointoperator-= (const Point &right)
 Subtracts the given vector.
 
const Pointoperator*= (const float &right)
 Multiplies by given scalar.
 
const Pointoperator/= (const float &right)
 Divides by given scalar.
 
std::string ToString () const
 Returns a string "[x, y]".
 

Public Attributes

float x
 X coord.
 
float y
 Y coord.
 

Friends

const Point operator+ (const Point &left, const Point &right)
 Adds two points.
 
const Point operator- (const Point &left, const Point &right)
 Subtracts two points.
 
const Point operator* (const float &left, const Point &right)
 Multiplies point by scalar.
 
const Point operator* (const Point &left, const float &right)
 Multiplies point by scalar.
 
const Point operator/ (const Point &left, const float &right)
 Divides point by scalar.
 

Detailed Description

2D point

Represents a 2D point (x, y). Contains the required methods for operating on points.

All methods are made inline to maximize optimization.


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