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>
157 return static_cast<FloatType
> (std::atan2 (static_cast<FloatType> (other.x -
x),
158 static_cast<FloatType> (
y - other.y)));
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)));
187 return Point<FloatType> (
static_cast<FloatType
> (
x + radiusX * std::sin (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
Point & operator=(const Point &other) noexcept
Definition: juce_Point.h:53
ValueType getY() const noexcept
Definition: juce_Point.h:68
#define noexcept
Definition: juce_CompilerSupport.h:141
Point(ValueType initialX, ValueType initialY) noexcept
Definition: juce_Point.h:49
ValueType getDistanceFrom(Point other) const noexcept
Definition: juce_Point.h:148
Point translated(ValueType deltaX, ValueType deltaY) const noexcept
Definition: juce_Point.h:90
int roundToInt(const FloatType value) noexcept
Definition: juce_core.h:418
Point< double > toDouble() const noexcept
Definition: juce_Point.h:217
ValueType getDistanceFromOrigin() const noexcept
Definition: juce_Point.h:145
Point< FloatType > getPointOnCircumference(float radius, float angle) const noexcept
Definition: juce_Point.h:174
Definition: juce_Point.h:39
Definition: juce_String.h:43
FloatType getAngleToPoint(Point other) const noexcept
Definition: juce_Point.h:155
Point(const Point &other) noexcept
Definition: juce_Point.h:46
String toString() const
Definition: juce_Point.h:223
Point withX(ValueType newX) const noexcept
Definition: juce_Point.h:77
bool operator==(Point other) const noexcept
Definition: juce_Point.h:55
void setX(ValueType newX) noexcept
Definition: juce_Point.h:71
Point transformedBy(const AffineTransform &transform) const noexcept
Definition: juce_Point.h:203
Point< float > toFloat() const noexcept
Definition: juce_Point.h:214
FloatType getDotProduct(Point other) const noexcept
Definition: juce_Point.h:192
Point & operator+=(Point other) noexcept
Definition: juce_Point.h:96
bool isOrigin() const noexcept
Definition: juce_Point.h:59
Point< int > roundToInt() const noexcept
Definition: juce_Point.h:220
Point & operator/=(Point< OtherType > other) noexcept
Definition: juce_Point.h:118
Point operator-() const noexcept
Definition: juce_Point.h:137
void setXY(ValueType newX, ValueType newY) noexcept
Definition: juce_Point.h:83
void setY(ValueType newY) noexcept
Definition: juce_Point.h:74
Point operator/(Point< OtherType > other) const noexcept
Definition: juce_Point.h:114
void applyTransform(const AffineTransform &transform) noexcept
Definition: juce_Point.h:200
Type juce_hypot(Type a, Type b) noexcept
Definition: juce_core.h:313
Point & operator*=(Point< OtherType > other) noexcept
Definition: juce_Point.h:110
Point & operator-=(Point other) noexcept
Definition: juce_Point.h:102
float type
Definition: juce_MathsFunctions.h:607
Point< int > toInt() const noexcept
Definition: juce_Point.h:211
bool operator!=(Point other) const noexcept
Definition: juce_Point.h:56
Point operator+(Point other) const noexcept
Definition: juce_Point.h:93
ValueType getX() const noexcept
Definition: juce_Point.h:65
bool isFinite() const noexcept
Definition: juce_Point.h:62
bool juce_isfinite(NumericType) noexcept
Definition: juce_core.h:374
Point rotatedAboutOrigin(ValueType angleRadians) const noexcept
Definition: juce_Point.h:164
TypeHelpers::SmallestFloatType< TOUCHINPUT >::type FloatType
Definition: juce_Point.h:141
Point withY(ValueType newY) const noexcept
Definition: juce_Point.h:80
Point() noexcept
Definition: juce_Point.h:43
Point operator*(Point< OtherType > other) const noexcept
Definition: juce_Point.h:106
ValueType x
Definition: juce_Point.h:226
Point< FloatType > getPointOnCircumference(float radiusX, float radiusY, float angle) const noexcept
Definition: juce_Point.h:185
void addXY(ValueType xToAdd, ValueType yToAdd) noexcept
Definition: juce_Point.h:86
ValueType y
Definition: juce_Point.h:227