mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
forgot some constexpr functions
This commit is contained in:
parent
d7693ad130
commit
a42b81ae5e
1 changed files with 4 additions and 4 deletions
|
@ -170,7 +170,7 @@ public:
|
||||||
@return float
|
@return float
|
||||||
@since v2.1.4
|
@since v2.1.4
|
||||||
*/
|
*/
|
||||||
inline constexpr float getDistance(const CCPoint& other) const {
|
inline float getDistance(const CCPoint& other) const {
|
||||||
return (*this - other).getLength();
|
return (*this - other).getLength();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ public:
|
||||||
@return CCPoint
|
@return CCPoint
|
||||||
@since v2.1.4
|
@since v2.1.4
|
||||||
*/
|
*/
|
||||||
inline constexpr CCPoint normalize() const {
|
inline CCPoint normalize() const {
|
||||||
float length = getLength();
|
float length = getLength();
|
||||||
if(length == 0.) return CCPoint(1.f, 0);
|
if(length == 0.) return CCPoint(1.f, 0);
|
||||||
return *this / getLength();
|
return *this / getLength();
|
||||||
|
@ -278,11 +278,11 @@ public:
|
||||||
@returns the rotated point
|
@returns the rotated point
|
||||||
@since v2.1.4
|
@since v2.1.4
|
||||||
*/
|
*/
|
||||||
inline constexpr CCPoint rotateByAngle(const CCPoint& pivot, float angle) const {
|
inline CCPoint rotateByAngle(const CCPoint& pivot, float angle) const {
|
||||||
return pivot + (*this - pivot).rotate(CCPoint::forAngle(angle));
|
return pivot + (*this - pivot).rotate(CCPoint::forAngle(angle));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline constexpr CCPoint forAngle(const float a)
|
static inline CCPoint forAngle(const float a)
|
||||||
{
|
{
|
||||||
return CCPoint(cosf(a), sinf(a));
|
return CCPoint(cosf(a), sinf(a));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue