Version: 3.3.1
wxPoint2DDouble Class Reference

#include <wx/geometry.h>

Detailed Description

wxPoint2DDouble represents a point in a 2D (Cartesian) coordinate system, with additional vector operations available.

Miscellaneous operators

Note that binary operators are defined as friend functions inside this class, making them accessible via argument-dependent lookup, but hidden otherwise.

wxPoint2DDouble operator- () const
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDoubleoperator= (const wxPoint2DDouble &pt)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDoubleoperator+= (const wxPoint2DDouble &pt)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDoubleoperator-= (const wxPoint2DDouble &pt)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDoubleoperator*= (wxDouble n)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDoubleoperator*= (wxInt32 n)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDoubleoperator/= (wxDouble n)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDoubleoperator/= (wxInt32 n)
 Returns the reflection (i.e., negation) of this point. More...
 
bool operator== (const wxPoint2DDouble &pt) const
 Returns the reflection (i.e., negation) of this point. More...
 
bool operator!= (const wxPoint2DDouble &pt) const
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDouble operator+ (const wxPoint2DDouble &pt1, const wxPoint2DDouble &pt2)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDouble operator- (const wxPoint2DDouble &pt1, const wxPoint2DDouble &pt2)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDouble operator* (wxDouble n, const wxPoint2DDouble &pt)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDouble operator* (wxInt32 n, const wxPoint2DDouble &pt)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDouble operator* (const wxPoint2DDouble &pt, wxDouble n)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDouble operator* (const wxPoint2DDouble &pt, wxInt32 n)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDouble operator/ (const wxPoint2DDouble &pt, wxDouble n)
 Returns the reflection (i.e., negation) of this point. More...
 
wxPoint2DDouble operator/ (const wxPoint2DDouble &pt, wxInt32 n)
 Returns the reflection (i.e., negation) of this point. More...
 

Public Member Functions

 wxPoint2DDouble ()
 Initializes to zero the x and y members. More...
 
 wxPoint2DDouble (wxDouble x, wxDouble y)
 Initializes the point with the given coordinates. More...
 
 wxPoint2DDouble (const wxPoint2DDouble &pt)
 Initializes the point from another point. More...
 
 wxPoint2DDouble (const wxPoint2DInt &pt)
 Initializes the point from another point. More...
 
 wxPoint2DDouble (const wxPoint &pt)
 Initializes the point from another point. More...
 
void GetFloor (wxInt32 *x, wxInt32 *y) const
 Returns the floored value of the point's coordinates. More...
 
wxPoint GetFloor () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void GetRounded (wxInt32 *x, wxInt32 *y) const
 Returns the rounded value of the point's coordinates. More...
 
wxPoint GetRounded () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
wxDouble GetVectorLength () const
 Returns the hypotenuse, where the X and Y coordinates of the point represent the lengths of the base and height sides of a right triangle. More...
 
void SetVectorLength (wxDouble length)
 Sets the vector length to length, preserving the right angle and altering the X and Y values (which represent the base and height sides of a right triangle). More...
 
wxDouble GetVectorAngle () const
 Returns the principal value of the arc tangent of the Y and X values, expressed in degrees. More...
 
void SetVectorAngle (wxDouble degrees)
 Repositions the X and Y coordinates based on the provided angle's degrees. More...
 
void Normalize ()
 Sets the vector length to 1.0, preserving the right angle and altering the X and Y values (which represent the base and height sides of a right triangle). More...
 
wxDouble GetDistance (const wxPoint2DDouble &pt) const
 Returns the distance between this point and pt. More...
 
wxDouble GetDistanceSquare (const wxPoint2DDouble &pt) const
 Returns the squared distance between this point and pt. More...
 
wxDouble GetDotProduct (const wxPoint2DDouble &vec) const
 Returns the dot (i.e., scalar) product, where the products of the X and Y values of this point and are added. More...
 
wxDouble GetCrossProduct (const wxPoint2DDouble &vec) const
 Returns the cross product, where the products of the Y values of this point and are subtracted from the X products. More...
 

Public Attributes

wxDouble m_x
 X coordinate of this point. More...
 
wxDouble m_y
 Y coordinate of this point. More...
 

Constructor & Destructor Documentation

◆ wxPoint2DDouble() [1/5]

wxPoint2DDouble::wxPoint2DDouble ( )

Initializes to zero the x and y members.

◆ wxPoint2DDouble() [2/5]

wxPoint2DDouble::wxPoint2DDouble ( wxDouble  x,
wxDouble  y 
)

Initializes the point with the given coordinates.

◆ wxPoint2DDouble() [3/5]

wxPoint2DDouble::wxPoint2DDouble ( const wxPoint2DDouble pt)

Initializes the point from another point.

◆ wxPoint2DDouble() [4/5]

wxPoint2DDouble::wxPoint2DDouble ( const wxPoint2DInt pt)

Initializes the point from another point.

◆ wxPoint2DDouble() [5/5]

wxPoint2DDouble::wxPoint2DDouble ( const wxPoint pt)

Initializes the point from another point.

Member Function Documentation

◆ GetCrossProduct()

wxDouble wxPoint2DDouble::GetCrossProduct ( const wxPoint2DDouble vec) const

Returns the cross product, where the products of the Y values of this point and are subtracted from the X products.

This represents another vector that is at right angles to both points.

◆ GetDistance()

wxDouble wxPoint2DDouble::GetDistance ( const wxPoint2DDouble pt) const

Returns the distance between this point and pt.

◆ GetDistanceSquare()

wxDouble wxPoint2DDouble::GetDistanceSquare ( const wxPoint2DDouble pt) const

Returns the squared distance between this point and pt.

◆ GetDotProduct()

wxDouble wxPoint2DDouble::GetDotProduct ( const wxPoint2DDouble vec) const

Returns the dot (i.e., scalar) product, where the products of the X and Y values of this point and are added.

◆ GetFloor() [1/2]

wxPoint wxPoint2DDouble::GetFloor ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ GetFloor() [2/2]

void wxPoint2DDouble::GetFloor ( wxInt32 x,
wxInt32 y 
) const

Returns the floored value of the point's coordinates.

Parameters
[out]xThe value to write the floored X coordinate to.
[out]yThe value to write the floored Y coordinate to.

◆ GetRounded() [1/2]

wxPoint wxPoint2DDouble::GetRounded ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ GetRounded() [2/2]

void wxPoint2DDouble::GetRounded ( wxInt32 x,
wxInt32 y 
) const

Returns the rounded value of the point's coordinates.

Parameters
[out]xThe value to write the rounded X coordinate to.
[out]yThe value to write the rounded Y coordinate to.

◆ GetVectorAngle()

wxDouble wxPoint2DDouble::GetVectorAngle ( ) const

Returns the principal value of the arc tangent of the Y and X values, expressed in degrees.

◆ GetVectorLength()

wxDouble wxPoint2DDouble::GetVectorLength ( ) const

Returns the hypotenuse, where the X and Y coordinates of the point represent the lengths of the base and height sides of a right triangle.

◆ Normalize()

void wxPoint2DDouble::Normalize ( )

Sets the vector length to 1.0, preserving the right angle and altering the X and Y values (which represent the base and height sides of a right triangle).

◆ operator!=()

bool wxPoint2DDouble::operator!= ( const wxPoint2DDouble pt) const

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator*=() [1/2]

wxPoint2DDouble& wxPoint2DDouble::operator*= ( wxDouble  n)

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator*=() [2/2]

wxPoint2DDouble& wxPoint2DDouble::operator*= ( wxInt32  n)

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator+=()

wxPoint2DDouble& wxPoint2DDouble::operator+= ( const wxPoint2DDouble pt)

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator-()

wxPoint2DDouble wxPoint2DDouble::operator- ( ) const

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator-=()

wxPoint2DDouble& wxPoint2DDouble::operator-= ( const wxPoint2DDouble pt)

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator/=() [1/2]

wxPoint2DDouble& wxPoint2DDouble::operator/= ( wxDouble  n)

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator/=() [2/2]

wxPoint2DDouble& wxPoint2DDouble::operator/= ( wxInt32  n)

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator=()

wxPoint2DDouble& wxPoint2DDouble::operator= ( const wxPoint2DDouble pt)

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator==()

bool wxPoint2DDouble::operator== ( const wxPoint2DDouble pt) const

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ SetVectorAngle()

void wxPoint2DDouble::SetVectorAngle ( wxDouble  degrees)

Repositions the X and Y coordinates based on the provided angle's degrees.

◆ SetVectorLength()

void wxPoint2DDouble::SetVectorLength ( wxDouble  length)

Sets the vector length to length, preserving the right angle and altering the X and Y values (which represent the base and height sides of a right triangle).

Friends And Related Function Documentation

◆ operator* [1/4]

wxPoint2DDouble operator* ( const wxPoint2DDouble pt,
wxDouble  n 
)
friend

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator* [2/4]

wxPoint2DDouble operator* ( const wxPoint2DDouble pt,
wxInt32  n 
)
friend

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator* [3/4]

wxPoint2DDouble operator* ( wxDouble  n,
const wxPoint2DDouble pt 
)
friend

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator* [4/4]

wxPoint2DDouble operator* ( wxInt32  n,
const wxPoint2DDouble pt 
)
friend

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator+

wxPoint2DDouble operator+ ( const wxPoint2DDouble pt1,
const wxPoint2DDouble pt2 
)
friend

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator-

wxPoint2DDouble operator- ( const wxPoint2DDouble pt1,
const wxPoint2DDouble pt2 
)
friend

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator/ [1/2]

wxPoint2DDouble operator/ ( const wxPoint2DDouble pt,
wxDouble  n 
)
friend

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

◆ operator/ [2/2]

wxPoint2DDouble operator/ ( const wxPoint2DDouble pt,
wxInt32  n 
)
friend

Returns the reflection (i.e., negation) of this point.

For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).

Member Data Documentation

◆ m_x

wxDouble wxPoint2DDouble::m_x

X coordinate of this point.

◆ m_y

wxDouble wxPoint2DDouble::m_y

Y coordinate of this point.