Go to the documentation of this file.
25 #ifndef JUCE_POINT_H_INCLUDED
26 #define JUCE_POINT_H_INCLUDED
38 template <
typename ValueType>
49 Point (ValueType initialX, ValueType initialY)
noexcept :
x (initialX),
y (initialY) {}
86 void addXY (ValueType xToAdd, ValueType yToAdd)
noexcept {
x += xToAdd;
y += yToAdd; }
105 template <
typename OtherType>
109 template <
typename OtherType>
113 template <
typename OtherType>
117 template <
typename OtherType>
121 template <
typename FloatType>
125 template <
typename FloatType>
129 template <
typename FloatType>
133 template <
typename FloatType>
166 return Point (
x * std::cos (angleRadians) -
y * std::sin (angleRadians),
167 x * std::sin (angleRadians) +
y * std::cos (angleRadians));
177 static_cast<FloatType> (
y - radius * std::cos (angle)));
188 static_cast<FloatType> (
y - radiusY * std::cos (angle)));
205 return Point (
static_cast<ValueType
> (transform.mat00 *
x + transform.mat01 *
y + transform.mat02),
206 static_cast<ValueType
> (transform.mat10 *
x + transform.mat11 *
y + transform.mat12));
231 #endif // JUCE_POINT_H_INCLUDED
ValueType x
Definition: juce_Point.h:226
String toString() const
Definition: juce_Point.h:223
Point< double > toDouble() const noexcept
Definition: juce_Point.h:217
ValueType getDistanceFromOrigin() const noexcept
Definition: juce_Point.h:145
Point & operator=(const Point &other) noexcept
Definition: juce_Point.h:53
void addXY(ValueType xToAdd, ValueType yToAdd) noexcept
Definition: juce_Point.h:86
Definition: juce_String.h:43
Point(ValueType initialX, ValueType initialY) noexcept
Definition: juce_Point.h:49
ValueType getY() const noexcept
Definition: juce_Point.h:68
Point< float > toFloat() const noexcept
Definition: juce_Point.h:214
FloatType getDotProduct(Point other) const noexcept
Definition: juce_Point.h:192
#define noexcept
Definition: juce_CompilerSupport.h:141
Point & operator+=(Point other) noexcept
Definition: juce_Point.h:96
ValueType getDistanceFrom(Point other) const noexcept
Definition: juce_Point.h:148
Point translated(ValueType deltaX, ValueType deltaY) const noexcept
Definition: juce_Point.h:90
Point(const Point &other) noexcept
Definition: juce_Point.h:46
void setX(ValueType newX) noexcept
Definition: juce_Point.h:71
Point< FloatType > getPointOnCircumference(float radius, float angle) const noexcept
Definition: juce_Point.h:174
Type juce_hypot(Type a, Type b) noexcept
Definition: juce_MathsFunctions.h:312
float type
Definition: juce_MathsFunctions.h:607
FloatType getAngleToPoint(Point other) const noexcept
Definition: juce_Point.h:155
void setY(ValueType newY) noexcept
Definition: juce_Point.h:74
bool isOrigin() const noexcept
Definition: juce_Point.h:59
int roundToInt(const FloatType value) noexcept
Definition: juce_MathsFunctions.h:417
Point withX(ValueType newX) const noexcept
Definition: juce_Point.h:77
bool operator==(Point other) const noexcept
Definition: juce_Point.h:55
bool juce_isfinite(NumericType) noexcept
Definition: juce_MathsFunctions.h:373
Point transformedBy(const AffineTransform &transform) const noexcept
Definition: juce_Point.h:203
Point< int > toInt() const noexcept
Definition: juce_Point.h:211
Point operator+(Point other) const noexcept
Definition: juce_Point.h:93
ValueType getX() const noexcept
Definition: juce_Point.h:65
Point & operator/=(Point< OtherType > other) noexcept
Definition: juce_Point.h:118
Point rotatedAboutOrigin(ValueType angleRadians) const noexcept
Definition: juce_Point.h:164
Point withY(ValueType newY) const noexcept
Definition: juce_Point.h:80
void applyTransform(const AffineTransform &transform) noexcept
Definition: juce_Point.h:200
Point & operator*=(Point< OtherType > other) noexcept
Definition: juce_Point.h:110
Point< int > roundToInt() const noexcept
Definition: juce_Point.h:220
Point() noexcept
Definition: juce_Point.h:43
void setXY(ValueType newX, ValueType newY) noexcept
Definition: juce_Point.h:83
Point operator-() const noexcept
Definition: juce_Point.h:137
Definition: juce_Point.h:39
Point operator/(Point< OtherType > other) const noexcept
Definition: juce_Point.h:114
Point< FloatType > getPointOnCircumference(float radiusX, float radiusY, float angle) const noexcept
Definition: juce_Point.h:185
ValueType y
Definition: juce_Point.h:227
bool operator!=(Point other) const noexcept
Definition: juce_Point.h:56
Point & operator-=(Point other) noexcept
Definition: juce_Point.h:102
Point operator*(Point< OtherType > other) const noexcept
Definition: juce_Point.h:106
bool isFinite() const noexcept
Definition: juce_Point.h:62
TypeHelpers::SmallestFloatType< int >::type FloatType
Definition: juce_Point.h:141