40template <
typename ValueType>
45 constexpr Point() =
default;
51 constexpr Point (ValueType initialX, ValueType initialY)
noexcept :
x (initialX),
y (initialY) {}
57 constexpr inline bool operator== (
Point other)
const noexcept {
return x == other.x &&
y == other.y; }
58 constexpr inline bool operator!= (
Point other)
const noexcept {
return x != other.x ||
y != other.y; }
73 inline void setX (ValueType newX)
noexcept {
x = newX; }
76 inline void setY (ValueType newY)
noexcept {
y = newY; }
85 void setXY (ValueType newX, ValueType newY)
noexcept {
x = newX;
y = newY; }
88 void addXY (ValueType xToAdd, ValueType yToAdd)
noexcept {
x += xToAdd;
y += yToAdd; }
92 constexpr Point translated (ValueType deltaX, ValueType deltaY)
const noexcept {
return Point (
x + deltaX,
y + deltaY); }
95 constexpr Point operator+ (
Point other)
const noexcept {
return Point (
x + other.x,
y + other.y); }
98 Point& operator+= (
Point other)
noexcept {
x += other.x;
y += other.y;
return *
this; }
101 constexpr Point operator- (
Point other)
const noexcept {
return Point (
x - other.x,
y - other.y); }
104 Point& operator-= (
Point other)
noexcept {
x -= other.x;
y -= other.y;
return *
this; }
107 template <
typename OtherType>
111 template <
typename OtherType>
115 template <
typename OtherType>
119 template <
typename OtherType>
123 template <
typename OtherType>
124 constexpr Point operator* (OtherType multiplier)
const noexcept
126 using CommonType =
typename std::common_type<ValueType, OtherType>::type;
127 return Point ((ValueType) ((CommonType)
x * (CommonType) multiplier),
128 (ValueType) ((CommonType)
y * (CommonType) multiplier));
132 template <
typename OtherType>
133 constexpr Point operator/ (OtherType divisor)
const noexcept
135 using CommonType =
typename std::common_type<ValueType, OtherType>::type;
136 return Point ((ValueType) ((CommonType)
x / (CommonType) divisor),
137 (ValueType) ((CommonType)
y / (CommonType) divisor));
141 template <
typename FloatType>
142 Point& operator*= (
FloatType multiplier)
noexcept {
x = (ValueType) (
x * multiplier);
y = (ValueType) (
y * multiplier);
return *
this; }
145 template <
typename FloatType>
146 Point& operator/= (
FloatType divisor)
noexcept {
x = (ValueType) (
x / divisor);
y = (ValueType) (
y / divisor);
return *
this; }
186 return Point (
x * std::cos (angleRadians) -
y * std::sin (angleRadians),
187 x * std::sin (angleRadians) +
y * std::cos (angleRadians));
197 static_cast<FloatType> (
y - radius * std::cos (angle)));
208 static_cast<FloatType> (
y - radiusY * std::cos (angle)));
225 return Point (
static_cast<ValueType
> (transform.mat00 * (
float)
x + transform.mat01 * (
float)
y + transform.mat02),
226 static_cast<ValueType
> (transform.mat10 * (
float)
x + transform.mat11 * (
float)
y + transform.mat12));
251template <
typename ValueType>
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_Point.h:42
constexpr FloatType getDotProduct(Point other) const noexcept
Definition juce_Point.h:212
constexpr Point translated(ValueType deltaX, ValueType deltaY) const noexcept
Definition juce_Point.h:92
ValueType getDistanceFrom(Point other) const noexcept
Definition juce_Point.h:160
Point rotatedAboutOrigin(ValueType angleRadians) const noexcept
Definition juce_Point.h:184
FloatType getAngleToPoint(Point other) const noexcept
Definition juce_Point.h:175
constexpr Point< float > toFloat() const noexcept
Definition juce_Point.h:234
constexpr Point()=default
Definition Geometry.cpp:36
constexpr Point operator-() const noexcept
Definition juce_Point.h:149
constexpr Point withY(ValueType newY) const noexcept
Definition juce_Point.h:82
void setXY(ValueType newX, ValueType newY) noexcept
Definition juce_Point.h:85
void setX(ValueType newX) noexcept
Definition juce_Point.h:73
constexpr ValueType getDistanceSquaredFromOrigin() const noexcept
Definition juce_Point.h:163
void setY(ValueType newY) noexcept
Definition juce_Point.h:76
constexpr ValueType getX() const noexcept
Definition juce_Point.h:67
constexpr Point< int > roundToInt() const noexcept
Definition juce_Point.h:240
constexpr Point< int > toInt() const noexcept
Definition juce_Point.h:231
constexpr Point< double > toDouble() const noexcept
Definition juce_Point.h:237
String toString() const
Definition juce_Point.h:243
void applyTransform(const AffineTransform &transform) noexcept
Definition juce_Point.h:220
constexpr bool isOrigin() const noexcept
Definition juce_Point.h:61
constexpr ValueType getY() const noexcept
Definition juce_Point.h:70
ValueType y
Definition juce_Point.h:247
void addXY(ValueType xToAdd, ValueType yToAdd) noexcept
Definition juce_Point.h:88
Point transformedBy(const AffineTransform &transform) const noexcept
Definition juce_Point.h:223
typename TypeHelpers::SmallestFloatType< ValueType >::type FloatType
Definition juce_Point.h:153
constexpr Point(const Point &)=default
constexpr bool isFinite() const noexcept
Definition juce_Point.h:64
constexpr ValueType getDistanceSquaredFrom(Point other) const noexcept
Definition juce_Point.h:166
ValueType x
Definition juce_Point.h:246
constexpr Point withX(ValueType newX) const noexcept
Definition juce_Point.h:79
Point< FloatType > getPointOnCircumference(float radiusX, float radiusY, float angle) const noexcept
Definition juce_Point.h:205
Point< FloatType > getPointOnCircumference(float radius, float angle) const noexcept
Definition juce_Point.h:194
ValueType getDistanceFromOrigin() const noexcept
Definition juce_Point.h:157
constexpr Point(ValueType initialX, ValueType initialY) noexcept
Definition juce_Point.h:51
Definition juce_String.h:53
int y
Definition inflate.c:1588
unsigned x[BMAX+1]
Definition inflate.c:1586
static PuglViewHint int value
Definition pugl.h:1708
Definition carla_juce.cpp:31
bool juce_isfinite(NumericType) noexcept
Definition juce_MathsFunctions.h:421
Type juce_hypot(Type a, Type b) noexcept
Definition juce_MathsFunctions.h:352
int roundToInt(const FloatType value) noexcept
Definition juce_MathsFunctions.h:465
float type
Definition juce_MathsFunctions.h:657
uch * p
Definition crypt.c:594
#define const
Definition zconf.h:137