Mobile API Reference  MicroStrategy 2019
MsiChart::Point< T > Class Template Reference

#include <Point2D.h>

Public Member Functions

 Point (T iX=T(), T iY=T())
 
 Point (const Point< T > &irPoint)
 
template<typename U >
 Point (const Point< U > &irPoint)
 
void Reset (T iX, T iY)
 
double DistanceSquared (const Point< T > &irPoint) const
 
double Distance (const Point< T > &irPoint) const
 
bool IsInPolygon (const std::vector< Point< T > > &irPolygon) const
 
bool IsStrictlyInPolygon (const std::vector< Point< T > > &irPolygon) const
 
bool operator!= (const Point< T > &irPoint) const
 
bool operator== (const Point< T > &irPoint) const
 
Point< T > operator- () const
 
void Rotate (const Point< T > &irAnchor, double iRadian)
 
Point< T > RotateAndClone (const Point< T > &irAnchor, double iRadian)
 
Point< T > MiddleTo (const Point< T > &irPoint) const
 
Point< T > Shifted (const Point< T > &irOffset) const
 
void Swap ()
 
void Swap (Point< T > &iorPoint)
 
bool IsOnSegment (const Point< T > &irSegmentStart, const Point< T > &irSegmentEnd, bool iExclude) const
 
bool IsOnVerOrHorSegment (const Point< T > &irSegmentStart, const Point< T > &irSegmentEnd) const
 
CGPoint GetCGPoint () const
 
double DistanceToPolygon (const std::vector< Point< T > > &irPolygon) const
 
double DistanceToLine (const Point< T > &irLineStart, const Point< T > &irLineEnd) const
 
template<>
void Rotate (const Point< Int32 > &irAnchor, double iRadian)
 

Public Attributes

x
 X-coordinate of current point. More...
 
y
 Y-coordinate of current point. More...
 

Detailed Description

template<typename T = double>
class MsiChart::Point< T >

This is a template class for 2D point.

Constructor & Destructor Documentation

◆ Point() [1/3]

template<typename T = double>
MsiChart::Point< T >::Point ( iX = T(),
iY = T() 
)
inline

Constructs from X and Y coordinates.

Parameters
iXX-coordinate of the point.
iYY-coordinate of the point.

◆ Point() [2/3]

template<typename T = double>
MsiChart::Point< T >::Point ( const Point< T > &  irPoint)
inline

Copy constructor

Parameters
irPointAnother Point<T> object.

◆ Point() [3/3]

template<typename T >
template<typename U >
MsiChart::Point< T >::Point ( const Point< U > &  irPoint)

Constructs from a Point<U> object.

Parameters
irPointA Point<U> object.

Member Function Documentation

◆ Distance()

template<typename T>
double MsiChart::Point< T >::Distance ( const Point< T > &  irPoint) const

Computes the distance between two points. Another point.

Returns
The distance between current point and irPoint.

◆ DistanceSquared()

template<typename T>
double MsiChart::Point< T >::DistanceSquared ( const Point< T > &  irPoint) const

Computes the square of the distance between two points. Another point.

Returns
The square of the distance between current point and irPoint.

◆ DistanceToLine()

template<typename T>
double MsiChart::Point< T >::DistanceToLine ( const Point< T > &  irLineStart,
const Point< T > &  irLineEnd 
) const

Get the distance between current point and an input line segment.

Parameters
irLineStart,irLineEndSpecifies a line segment.
Returns
Return the distance between current point and an line segment.

◆ DistanceToPolygon()

template<typename T>
double MsiChart::Point< T >::DistanceToPolygon ( const std::vector< Point< T > > &  irPolygon) const

Get the distance between current point and an input polygon.

Parameters
irPolygonSpecifies a polygon.
Returns
Return the distance between current point and an input polygon. If current point is inside the input polygon, return 0.

◆ GetCGPoint()

template<typename T >
CGPoint MsiChart::Point< T >::GetCGPoint ( ) const

Get the CGPoint version of current point.

Returns
Return current point in CGPoint format.

◆ IsInPolygon()

template<typename T>
bool MsiChart::Point< T >::IsInPolygon ( const std::vector< Point< T > > &  irPolygon) const

Check whether current point is inside a polygon or not. Reference: http://local.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/

Parameters
irPolygonSpecifies a polygon.
Returns
Return true if current point is inside irPolygon. Otherwise, return false.

◆ IsOnSegment()

template<typename T>
bool MsiChart::Point< T >::IsOnSegment ( const Point< T > &  irSegmentStart,
const Point< T > &  irSegmentEnd,
bool  iExclude 
) const

Check whether current point is on a segment or not.

Parameters
irSegmentStart,irSegmentEndSpecifies a line segment. Indicates whether the two end points need to be excluded or not.

◆ IsOnVerOrHorSegment()

template<typename T>
bool MsiChart::Point< T >::IsOnVerOrHorSegment ( const Point< T > &  irSegmentStart,
const Point< T > &  irSegmentEnd 
) const

Check whether current point is on a vertical/horizontal segment or not.

Parameters
irSegmentStart,irSegmentEndSpecifies a line segment.
Returns
If it is on a vertical/horizontal segment, return true. Otherwise return false.

◆ IsStrictlyInPolygon()

template<typename T>
bool MsiChart::Point< T >::IsStrictlyInPolygon ( const std::vector< Point< T > > &  irPolygon) const

Check whether current point is strictly inside a polygon or not. A point is strictly inside a polygon if and only if (x+1,y),(x,y+1),(x-1,y) and (x,y-1) are inside that polygon.

Parameters
irPolygonSpecifies a polygon.
Returns
Return true if current point is strictly inside irPolygon. Otherwise, return false.

◆ MiddleTo()

template<typename T>
Point< T > MsiChart::Point< T >::MiddleTo ( const Point< T > &  irPoint) const

Computes the midpoint of two point. Specifies another point.

Returns
The midpoint of current point and irPoint.

◆ operator!=()

template<typename T>
bool MsiChart::Point< T >::operator!= ( const Point< T > &  irPoint) const

Check whether two points coincide with each other. Specifies another point.

Returns
Return true if the coordinates of current point is not the same as that of irPoint. Otherwise, return false.

◆ operator-()

template<typename T >
Point< T > MsiChart::Point< T >::operator- ( ) const

Return the central symmetric point of current point.

Returns
Point<T>(-x, -y).

◆ operator==()

template<typename T>
bool MsiChart::Point< T >::operator== ( const Point< T > &  irPoint) const

◆ Reset()

template<typename T>
void MsiChart::Point< T >::Reset ( iX,
iY 
)
inline

Set new coordinates for current point.

Parameters
iXX-coordinate of the point.
iYY-coordinate of the point.

◆ Rotate() [1/2]

template<typename T>
void MsiChart::Point< T >::Rotate ( const Point< T > &  irAnchor,
double  iRadian 
)

Rotate a point relative to another point. Specifies a reference point. Specifies a rotation angle.

◆ Rotate() [2/2]

template<>
void MsiChart::Point< Int32 >::Rotate ( const Point< Int32 > &  irAnchor,
double  iRadian 
)

◆ RotateAndClone()

template<typename T>
Point< T > MsiChart::Point< T >::RotateAndClone ( const Point< T > &  irAnchor,
double  iRadian 
)

Rotate a point relative to another point. Specifies a reference point. Specifies a rotation angle.

Returns
The rotated point.

◆ Shifted()

template<typename T>
Point< T > MsiChart::Point< T >::Shifted ( const Point< T > &  irOffset) const

Computes a shifted point based on current point and an offset. Specifies an offset based on current point.

Returns
Point<T>(x+irOffset.x,y+irOffset.y).

◆ Swap() [1/2]

template<typename T >
void MsiChart::Point< T >::Swap ( )

Swap current point's coordinate

◆ Swap() [2/2]

template<typename T>
void MsiChart::Point< T >::Swap ( Point< T > &  iorPoint)

Swap point value with another one

Member Data Documentation

◆ x

template<typename T = double>
T MsiChart::Point< T >::x

X-coordinate of current point.

◆ y

template<typename T = double>
T MsiChart::Point< T >::y

Y-coordinate of current point.