JUCE
|
A pair of (x, y) coordinates. More...
Public Types | |
typedef TypeHelpers::SmallestFloatType< ValueType >::type | FloatType |
This type will be double if the Point's type is double, otherwise it will be float. More... | |
Public Member Functions | |
Point () noexcept | |
Creates a point at the origin. More... | |
Point (const Point &other) noexcept | |
Creates a copy of another point. More... | |
Point (ValueType initialX, ValueType initialY) noexcept | |
Creates a point from an (x, y) position. More... | |
Point & | operator= (const Point &other) noexcept |
Copies this point from another one. More... | |
bool | operator== (Point other) const noexcept |
bool | operator!= (Point other) const noexcept |
bool | isOrigin () const noexcept |
Returns true if the point is (0, 0). More... | |
bool | isFinite () const noexcept |
Returns true if the coordinates are finite values. More... | |
ValueType | getX () const noexcept |
Returns the point's x coordinate. More... | |
ValueType | getY () const noexcept |
Returns the point's y coordinate. More... | |
void | setX (ValueType newX) noexcept |
Sets the point's x coordinate. More... | |
void | setY (ValueType newY) noexcept |
Sets the point's y coordinate. More... | |
Point | withX (ValueType newX) const noexcept |
Returns a point which has the same Y position as this one, but a new X. More... | |
Point | withY (ValueType newY) const noexcept |
Returns a point which has the same X position as this one, but a new Y. More... | |
void | setXY (ValueType newX, ValueType newY) noexcept |
Changes the point's x and y coordinates. More... | |
void | addXY (ValueType xToAdd, ValueType yToAdd) noexcept |
Adds a pair of coordinates to this value. More... | |
Point | translated (ValueType deltaX, ValueType deltaY) const noexcept |
Returns a point with a given offset from this one. More... | |
Point | operator+ (Point other) const noexcept |
Adds two points together. More... | |
Point & | operator+= (Point other) noexcept |
Adds another point's coordinates to this one. More... | |
Point | operator- (Point other) const noexcept |
Subtracts one points from another. More... | |
Point & | operator-= (Point other) noexcept |
Subtracts another point's coordinates to this one. More... | |
template<typename OtherType > | |
Point | operator* (Point< OtherType > other) const noexcept |
Multiplies two points together. More... | |
template<typename OtherType > | |
Point & | operator*= (Point< OtherType > other) noexcept |
Multiplies another point's coordinates to this one. More... | |
template<typename OtherType > | |
Point | operator/ (Point< OtherType > other) const noexcept |
Divides one point by another. More... | |
template<typename OtherType > | |
Point & | operator/= (Point< OtherType > other) noexcept |
Divides this point's coordinates by another. More... | |
template<typename FloatType > | |
Point | operator* (FloatType multiplier) const noexcept |
Returns a point whose coordinates are multiplied by a given scalar value. More... | |
template<typename FloatType > | |
Point | operator/ (FloatType divisor) const noexcept |
Returns a point whose coordinates are divided by a given scalar value. More... | |
template<typename FloatType > | |
Point & | operator*= (FloatType multiplier) noexcept |
Multiplies the point's coordinates by a scalar value. More... | |
template<typename FloatType > | |
Point & | operator/= (FloatType divisor) noexcept |
Divides the point's coordinates by a scalar value. More... | |
Point | operator- () const noexcept |
Returns the inverse of this point. More... | |
ValueType | getDistanceFromOrigin () const noexcept |
Returns the straight-line distance between this point and the origin. More... | |
ValueType | getDistanceFrom (Point other) const noexcept |
Returns the straight-line distance between this point and another one. More... | |
FloatType | getAngleToPoint (Point other) const noexcept |
Returns the angle from this point to another one. More... | |
Point | rotatedAboutOrigin (ValueType angleRadians) const noexcept |
Returns the point that would be reached by rotating this point clockwise about the origin by the specified angle. More... | |
Point< FloatType > | getPointOnCircumference (float radius, float angle) const noexcept |
Taking this point to be the centre of a circle, this returns a point on its circumference. More... | |
Point< FloatType > | getPointOnCircumference (float radiusX, float radiusY, float angle) const noexcept |
Taking this point to be the centre of an ellipse, this returns a point on its circumference. More... | |
FloatType | getDotProduct (Point other) const noexcept |
Returns the dot-product of two points (x1 * x2 + y1 * y2). More... | |
void | applyTransform (const AffineTransform &transform) noexcept |
Uses a transform to change the point's coordinates. More... | |
Point | transformedBy (const AffineTransform &transform) const noexcept |
Returns the position of this point, if it is transformed by a given AffineTransform. More... | |
Point< int > | toInt () const noexcept |
Casts this point to a Point<int> object. More... | |
Point< float > | toFloat () const noexcept |
Casts this point to a Point<float> object. More... | |
Point< double > | toDouble () const noexcept |
Casts this point to a Point<double> object. More... | |
Point< int > | roundToInt () const noexcept |
Casts this point to a Point<int> object using roundToInt() to convert the values. More... | |
String | toString () const |
Returns the point as a string in the form "x, y". More... | |
Public Attributes | |
ValueType | x |
The point's X coordinate. More... | |
ValueType | y |
The point's Y coordinate. More... | |
A pair of (x, y) coordinates.
The ValueType template should be a primitive type such as int, float, double, rather than a class.
typedef TypeHelpers::SmallestFloatType<ValueType>::type Point< ValueType >::FloatType |
This type will be double if the Point's type is double, otherwise it will be float.
Creates a point at the origin.
Referenced by Point< int >::operator*(), Point< int >::operator+(), Point< int >::operator-(), Point< int >::operator/(), Point< int >::rotatedAboutOrigin(), Point< int >::transformedBy(), Point< int >::translated(), Point< int >::withX(), and Point< int >::withY().
Creates a copy of another point.
|
noexcept |
Creates a point from an (x, y) position.
|
noexcept |
Copies this point from another one.
|
noexcept |
|
noexcept |
|
noexcept |
Returns true if the point is (0, 0).
Referenced by Line< ValueType >::withShortenedEnd().
|
noexcept |
Returns true if the coordinates are finite values.
|
noexcept |
Returns the point's x coordinate.
|
noexcept |
Returns the point's y coordinate.
|
noexcept |
Sets the point's x coordinate.
|
noexcept |
Sets the point's y coordinate.
Returns a point which has the same Y position as this one, but a new X.
Referenced by Line< ValueType >::withShortenedEnd().
Returns a point which has the same X position as this one, but a new Y.
Referenced by Line< ValueType >::withShortenedEnd().
|
noexcept |
Changes the point's x and y coordinates.
|
noexcept |
Adds a pair of coordinates to this value.
|
noexcept |
Returns a point with a given offset from this one.
|
noexcept |
Adds two points together.
|
noexcept |
Adds another point's coordinates to this one.
|
noexcept |
Subtracts one points from another.
|
noexcept |
Subtracts another point's coordinates to this one.
|
noexcept |
Multiplies two points together.
|
noexcept |
Multiplies another point's coordinates to this one.
|
noexcept |
Divides one point by another.
|
noexcept |
Divides this point's coordinates by another.
|
noexcept |
Returns a point whose coordinates are multiplied by a given scalar value.
|
noexcept |
Returns a point whose coordinates are divided by a given scalar value.
|
noexcept |
Multiplies the point's coordinates by a scalar value.
|
noexcept |
Divides the point's coordinates by a scalar value.
Returns the inverse of this point.
|
noexcept |
Returns the straight-line distance between this point and the origin.
|
noexcept |
Returns the straight-line distance between this point and another one.
Referenced by Line< ValueType >::getDistanceFromPoint().
|
noexcept |
Returns the angle from this point to another one.
The return value is the number of radians clockwise from the 12 o'clock direction, where this point is the centre and the other point is on the circumference.
|
noexcept |
Returns the point that would be reached by rotating this point clockwise about the origin by the specified angle.
|
noexcept |
Taking this point to be the centre of a circle, this returns a point on its circumference.
radius | the radius of the circle. |
angle | the angle of the point, in radians clockwise from the 12 o'clock position. |
|
noexcept |
Taking this point to be the centre of an ellipse, this returns a point on its circumference.
radiusX | the horizontal radius of the circle. |
radiusY | the vertical radius of the circle. |
angle | the angle of the point, in radians clockwise from the 12 o'clock position. |
|
noexcept |
Returns the dot-product of two points (x1 * x2 + y1 * y2).
|
noexcept |
Uses a transform to change the point's coordinates.
This will only compile if ValueType = float!
|
noexcept |
Returns the position of this point, if it is transformed by a given AffineTransform.
Casts this point to a Point<int> object.
Casts this point to a Point<float> object.
Casts this point to a Point<double> object.
Casts this point to a Point<int> object using roundToInt() to convert the values.
Returns the point as a string in the form "x, y".
ValueType Point< ValueType >::x |
The point's X coordinate.
Referenced by Point< int >::addXY(), Point< int >::applyTransform(), Line< ValueType >::findNearestProportionalPositionTo(), Point< int >::getAngleToPoint(), Point< int >::getDistanceFrom(), Point< int >::getDistanceFromOrigin(), Line< ValueType >::getDistanceFromPoint(), Point< int >::getDotProduct(), Line< ValueType >::getPointAlongLine(), Point< int >::getPointOnCircumference(), Draggable3DOrientation::getQuaternion(), Point< int >::getX(), Point< int >::isFinite(), Point< int >::isOrigin(), Point< int >::operator!=(), Point< int >::operator*(), Point< int >::operator*=(), Point< int >::operator+(), Point< int >::operator+=(), Point< int >::operator-(), Point< int >::operator-=(), Point< int >::operator/(), Point< int >::operator/=(), Point< int >::operator=(), Point< int >::operator==(), Point< int >::rotatedAboutOrigin(), Point< int >::roundToInt(), Point< int >::setX(), Point< int >::setXY(), Point< int >::toDouble(), Point< int >::toFloat(), Point< int >::toInt(), Point< int >::toString(), Point< int >::transformedBy(), Point< int >::translated(), Line< ValueType >::withShortenedEnd(), and Point< int >::withY().
ValueType Point< ValueType >::y |
The point's Y coordinate.
Referenced by Point< int >::addXY(), Point< int >::applyTransform(), Line< ValueType >::findNearestProportionalPositionTo(), Point< int >::getAngleToPoint(), Point< int >::getDistanceFrom(), Point< int >::getDistanceFromOrigin(), Line< ValueType >::getDistanceFromPoint(), Point< int >::getDotProduct(), Line< ValueType >::getPointAlongLine(), Point< int >::getPointOnCircumference(), Draggable3DOrientation::getQuaternion(), Point< int >::getY(), Point< int >::isFinite(), Point< int >::isOrigin(), Point< int >::operator!=(), Point< int >::operator*(), Point< int >::operator*=(), Point< int >::operator+(), Point< int >::operator+=(), Point< int >::operator-(), Point< int >::operator-=(), Point< int >::operator/(), Point< int >::operator/=(), Point< int >::operator=(), Point< int >::operator==(), Point< int >::rotatedAboutOrigin(), Point< int >::roundToInt(), Point< int >::setXY(), Point< int >::setY(), Point< int >::toDouble(), Point< int >::toFloat(), Point< int >::toInt(), Point< int >::toString(), Point< int >::transformedBy(), Point< int >::translated(), Line< ValueType >::withShortenedEnd(), and Point< int >::withX().