A pair of (x, y) coordinates. More...
#include <juce_Point.h>
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... | |
void | addXY (ValueType xToAdd, ValueType yToAdd) noexcept |
Adds a pair of coordinates to this value. More... | |
void | applyTransform (const AffineTransform &transform) noexcept |
Uses a transform to change the point's coordinates. More... | |
FloatType | getAngleToPoint (Point other) const noexcept |
Returns the angle from this point to another one. More... | |
ValueType | getDistanceFrom (Point other) const noexcept |
Returns the straight-line distance between this point and another one. More... | |
ValueType | getDistanceFromOrigin () const noexcept |
Returns the straight-line distance between this point and the origin. More... | |
ValueType | getDistanceSquaredFrom (Point other) const noexcept |
Returns the square of the straight-line distance between this point and another one. More... | |
ValueType | getDistanceSquaredFromOrigin () const noexcept |
Returns the square of the straight-line distance between this point and the origin. More... | |
FloatType | getDotProduct (Point other) const noexcept |
Returns the dot-product of two points (x1 * x2 + y1 * y2). 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... | |
ValueType | getX () const noexcept |
Returns the point's x coordinate. More... | |
ValueType | getY () const noexcept |
Returns the point's y coordinate. More... | |
bool | isFinite () const noexcept |
Returns true if the coordinates are finite values. More... | |
bool | isOrigin () const noexcept |
Returns true if the point is (0, 0). More... | |
bool | operator!= (Point other) const noexcept |
template<typename OtherType > | |
Point | operator* (Point< OtherType > other) const noexcept |
Multiplies two points together. 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 OtherType > | |
Point & | operator*= (Point< OtherType > other) noexcept |
Multiplies another point's coordinates to this one. More... | |
template<typename FloatType > | |
Point & | operator*= (FloatType multiplier) noexcept |
Multiplies the point's coordinates by a scalar value. 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- () const noexcept |
Returns the inverse of this point. 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 |
Divides one point by another. 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 OtherType > | |
Point & | operator/= (Point< OtherType > other) noexcept |
Divides this point's coordinates by another. More... | |
template<typename FloatType > | |
Point & | operator/= (FloatType divisor) noexcept |
Divides the point's coordinates by a scalar value. More... | |
Point & | operator= (const Point &other) noexcept |
Copies this point from another one. More... | |
bool | operator== (Point other) const noexcept |
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< int > | roundToInt () const noexcept |
Casts this point to a Point<int> object using roundToInt() to convert the values. More... | |
void | setX (ValueType newX) noexcept |
Sets the point's x coordinate. More... | |
void | setXY (ValueType newX, ValueType newY) noexcept |
Changes the point's x and y coordinates. More... | |
void | setY (ValueType newY) noexcept |
Sets the point's y coordinate. More... | |
Point< double > | toDouble () const noexcept |
Casts this point to a Point<double> object. More... | |
Point< float > | toFloat () const noexcept |
Casts this point to a Point<float> object. More... | |
Point< int > | toInt () const noexcept |
Casts this point to a Point<int> object. More... | |
String | toString () const |
Returns the point as a string in the form "x, y". More... | |
Point | transformedBy (const AffineTransform &transform) const noexcept |
Returns the position of this point, if it is transformed by a given AffineTransform. More... | |
Point | translated (ValueType deltaX, ValueType deltaY) const noexcept |
Returns a point with a given offset from this one. 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... | |
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< ValueType >::operator*(), Point< ValueType >::operator+(), Point< ValueType >::operator-(), Point< ValueType >::operator/(), Point< ValueType >::rotatedAboutOrigin(), Point< ValueType >::transformedBy(), Point< ValueType >::translated(), Point< ValueType >::withX(), and Point< ValueType >::withY().
|
inlinenoexcept |
Creates a copy of another point.
|
inlinenoexcept |
Creates a point from an (x, y) position.
|
inlinenoexcept |
Adds a pair of coordinates to this value.
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Uses a transform to change the point's coordinates.
This will only compile if ValueType = float!
References Point< ValueType >::x, and Point< ValueType >::y.
Referenced by RenderingHelpers::GradientPixelIterators::Linear::Linear().
|
inlinenoexcept |
Returns the angle from this point to another one.
Taking this point to be the centre of a circle, and the other point being a position on the circumference, the return value is the number of radians clockwise from the 12 o'clock direction. So 12 o'clock = 0, 3 o'clock = Pi/2, 6 o'clock = Pi, 9 o'clock = -Pi/2
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns the straight-line distance between this point and another one.
References juce_hypot(), Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns the straight-line distance between this point and the origin.
References juce_hypot(), Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns the square of the straight-line distance between this point and another one.
|
inlinenoexcept |
Returns the square of the straight-line distance between this point and the origin.
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns the dot-product of two points (x1 * x2 + y1 * y2).
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
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. |
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
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. |
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns the point's x coordinate.
References Point< ValueType >::x.
|
inlinenoexcept |
Returns the point's y coordinate.
References Point< ValueType >::y.
Referenced by RenderingHelpers::GradientPixelIterators::Linear::Linear().
|
inlinenoexcept |
Returns true if the coordinates are finite values.
References juce::juce_isfinite(), Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns true if the point is (0, 0).
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Multiplies two points together.
References Point< ValueType >::Point(), Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns a point whose coordinates are multiplied by a given scalar value.
References Point< ValueType >::Point(), Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Multiplies another point's coordinates to this one.
|
inlinenoexcept |
Multiplies the point's coordinates by a scalar value.
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Adds two points together.
References Point< ValueType >::Point(), Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Adds another point's coordinates to this one.
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Subtracts one points from another.
References Point< ValueType >::Point(), Point< ValueType >::x, and Point< ValueType >::y.
Returns the inverse of this point.
References Point< ValueType >::Point(), Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Subtracts another point's coordinates to this one.
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Divides one point by another.
References Point< ValueType >::Point(), Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns a point whose coordinates are divided by a given scalar value.
References Point< ValueType >::Point(), Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Divides this point's coordinates by another.
|
inlinenoexcept |
Divides the point's coordinates by a scalar value.
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Copies this point from another one.
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns the point that would be reached by rotating this point clockwise about the origin by the specified angle.
References Point< ValueType >::Point(), Point< ValueType >::x, and Point< ValueType >::y.
Casts this point to a Point<int> object using roundToInt() to convert the values.
References juce::roundToInt(), Point< ValueType >::x, and Point< ValueType >::y.
Referenced by FakeMouseMoveGenerator::timerCallback().
|
inlinenoexcept |
Sets the point's x coordinate.
References Point< ValueType >::x.
|
inlinenoexcept |
Changes the point's x and y coordinates.
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Sets the point's y coordinate.
References Point< ValueType >::y.
Casts this point to a Point<double> object.
References Point< ValueType >::x, and Point< ValueType >::y.
Casts this point to a Point<float> object.
References Point< ValueType >::x, and Point< ValueType >::y.
Casts this point to a Point<int> object.
References Point< ValueType >::x, and Point< ValueType >::y.
Returns the point as a string in the form "x, y".
References Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns the position of this point, if it is transformed by a given AffineTransform.
References Point< ValueType >::Point(), Point< ValueType >::x, and Point< ValueType >::y.
|
inlinenoexcept |
Returns a point with a given offset from this one.
References Point< ValueType >::Point(), Point< ValueType >::x, and Point< ValueType >::y.
Returns a point which has the same Y position as this one, but a new X.
References Point< ValueType >::Point(), and Point< ValueType >::y.
Returns a point which has the same X position as this one, but a new Y.
References Point< ValueType >::Point(), and Point< ValueType >::x.
ValueType Point< ValueType >::x |
The point's X coordinate.
Referenced by Point< ValueType >::addXY(), Point< ValueType >::applyTransform(), RenderingHelpers::CachedGlyphEdgeTable< RendererType >::draw(), Point< ValueType >::getAngleToPoint(), Point< ValueType >::getDistanceFrom(), Point< ValueType >::getDistanceFromOrigin(), Point< ValueType >::getDistanceSquaredFromOrigin(), Point< ValueType >::getDotProduct(), Point< ValueType >::getPointOnCircumference(), Point< ValueType >::getX(), Point< ValueType >::isFinite(), Point< ValueType >::isOrigin(), RenderingHelpers::GradientPixelIterators::Linear::Linear(), Point< ValueType >::operator!=(), Point< ValueType >::operator*(), Point< ValueType >::operator*=(), Point< ValueType >::operator+(), Point< ValueType >::operator+=(), Point< ValueType >::operator-(), Point< ValueType >::operator-=(), Point< ValueType >::operator/(), Point< ValueType >::operator/=(), Point< ValueType >::operator=(), Point< ValueType >::operator==(), RenderingHelpers::GradientPixelIterators::Radial::Radial(), Point< ValueType >::rotatedAboutOrigin(), Point< ValueType >::roundToInt(), Point< ValueType >::setX(), Point< ValueType >::setXY(), Point< ValueType >::toDouble(), Point< ValueType >::toFloat(), Point< ValueType >::toInt(), Point< ValueType >::toString(), Point< ValueType >::transformedBy(), RenderingHelpers::ClipRegions< SavedStateType >::EdgeTableRegion::translate(), Point< ValueType >::translated(), and Point< ValueType >::withY().
ValueType Point< ValueType >::y |
The point's Y coordinate.
Referenced by Point< ValueType >::addXY(), Point< ValueType >::applyTransform(), RenderingHelpers::CachedGlyphEdgeTable< RendererType >::draw(), Point< ValueType >::getAngleToPoint(), Point< ValueType >::getDistanceFrom(), Point< ValueType >::getDistanceFromOrigin(), Point< ValueType >::getDistanceSquaredFromOrigin(), Point< ValueType >::getDotProduct(), Point< ValueType >::getPointOnCircumference(), Point< ValueType >::getY(), Point< ValueType >::isFinite(), Point< ValueType >::isOrigin(), RenderingHelpers::GradientPixelIterators::Linear::Linear(), Point< ValueType >::operator!=(), Point< ValueType >::operator*(), Point< ValueType >::operator*=(), Point< ValueType >::operator+(), Point< ValueType >::operator+=(), Point< ValueType >::operator-(), Point< ValueType >::operator-=(), Point< ValueType >::operator/(), Point< ValueType >::operator/=(), Point< ValueType >::operator=(), Point< ValueType >::operator==(), RenderingHelpers::GradientPixelIterators::Radial::Radial(), Point< ValueType >::rotatedAboutOrigin(), Point< ValueType >::roundToInt(), Point< ValueType >::setXY(), Point< ValueType >::setY(), Point< ValueType >::toDouble(), Point< ValueType >::toFloat(), Point< ValueType >::toInt(), Point< ValueType >::toString(), Point< ValueType >::transformedBy(), RenderingHelpers::ClipRegions< SavedStateType >::EdgeTableRegion::translate(), Point< ValueType >::translated(), and Point< ValueType >::withX().