# Point2d Class Reference

## Detailed Description

2D point (vector) class with double type elements Inheritance diagram for Point2d:

## Public Member Functions

Binary operators
Point2 operator+ (const Point2 &p) const

Point2 operator+ (const double &v) const

Point2 operator- (const Point2 &p) const

Point2 operator- (const double &v) const

Point2 operator* (const Point2 &p) const

Point2 operator* (const double &v) const

Point2 operator/ (const Point2 &p) const

Point2 operator/ (const double &v) const

Unary operators
Point2 operator- () const

Set & Get value methods
void Zero ()

void Get (double *p) const

void Set (const double *p)

void Set (const double &v)

void Set (const double &_x, const double &_y)

General methods
double LengthSquared () const

double Length () const

void Normalize ()

Point2 GetNormalized () const

double Sum () const

bool IsZero () const

double Min () const

double Max () const

int MinID () const

int MaxID () const

Limit methods
void Clamp (const double &minValue, const double &maxValue)

void ClampMin (const double &v)

void ClampMax (const double &v)

void Abs ()

Assignment operators
const Point2operator+= (const Point2 &p)

const Point2operator+= (const double &v)

const Point2operator-= (const Point2 &p)

const Point2operator-= (const double &v)

const Point2operator*= (const Point2 &p)

const Point2operator*= (const double &v)

const Point2operator/= (const Point2 &p)

const Point2operator/= (const double &v)

Test operators
bool operator== (const Point2 &p) const

bool operator!= (const Point2 &p) const

Access operators
double & operator[] (int i)

const double & operator[] (int i) const

double & Element (int i)

const double & Element (int i) const

double * Data ()

const double * Data () const

Cross product and dot product
double Cross (const Point2 &p) const

double operator^ (const Point2 &p) const

double Dot (const Point2 &p) const

double operator% (const Point2 &p) const

## Public Attributes

Components of the point/vector
double x

double y

## § Zero()

 void Zero ( )
inherited

Sets the coordinates as zero.

## § Get()

 void Get ( double * p ) const
inherited

Puts the coordinate values into the array.

## § Set() [1/3]

 void Set ( const double * p )
inherited

Sets the coordinates using the values in the given array.

## § Set() [2/3]

 void Set ( const double & v )
inherited

Sets all coordinates using the given value.

## § Set() [3/3]

 void Set ( const double & _x, const double & _y )
inherited

Sets the coordinates using the given values.

## § LengthSquared()

 double LengthSquared ( ) const
inherited

Returns the square of the length. Effectively, this is the dot product of the vector with itself.

## § Length()

 double Length ( ) const
inherited

Returns the length of the vector.

## § Normalize()

 void Normalize ( )
inherited

Normalizes the vector, such that its length becomes 1.

## § GetNormalized()

 Point2 GetNormalized ( ) const
inherited

Returns a normalized copy of the vector.

## § Sum()

 double Sum ( ) const
inherited

Returns the sum of its components.

## § IsZero()

 bool IsZero ( ) const
inherited

Returns true if all components are exactly zero.

## § Min()

 double Min ( ) const
inherited

Returns the square of the length. Effectively, this is the dot product of the vector with itself.

## § Max()

 double Max ( ) const
inherited

Returns the square of the length. Effectively, this is the dot product of the vector with itself.

## § MinID()

 int MinID ( ) const
inherited

Returns the square of the length. Effectively, this is the dot product of the vector with itself.

## § MaxID()

 int MaxID ( ) const
inherited

Returns the square of the length. Effectively, this is the dot product of the vector with itself.

## § Clamp()

 void Clamp ( const double & minValue, const double & maxValue )
inherited

Converts all negative components to positive values.

## § ClampMin()

 void ClampMin ( const double & v )
inherited

Converts all negative components to positive values.

## § ClampMax()

 void ClampMax ( const double & v )
inherited

Converts all negative components to positive values.

## § Abs()

 void Abs ( )
inherited

Converts all negative components to positive values.

## § Cross()

 double Cross ( const Point2< double > & p ) const
inherited

Cross product.

## § operator^()

 double operator^ ( const Point2< double > & p ) const
inherited

Cross product operator.

## § Dot()

 double Dot ( const Point2< double > & p ) const
inherited

Dot product.

## § operator%()

 double operator% ( const Point2< double > & p ) const
inherited

Dot product operator.