summaryrefslogtreecommitdiff
path: root/Runtime/Math
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-17 23:05:01 +0800
committerchai <chaifix@163.com>2021-10-17 23:05:01 +0800
commit7c8c68d79343d04be382334c15a73d079450857c (patch)
tree9aaacc042f0b7eeb4123c07dcc5f49c14fd8026c /Runtime/Math
parent6e73ca6ada8a41692809dae5db89c8db0675ce1e (diff)
*misc
Diffstat (limited to 'Runtime/Math')
-rw-r--r--Runtime/Math/FloatConversion.h38
-rw-r--r--Runtime/Math/Rect.h38
-rw-r--r--Runtime/Math/Vector2.h10
3 files changed, 43 insertions, 43 deletions
diff --git a/Runtime/Math/FloatConversion.h b/Runtime/Math/FloatConversion.h
index e5c0f23..96a4d1d 100644
--- a/Runtime/Math/FloatConversion.h
+++ b/Runtime/Math/FloatConversion.h
@@ -189,7 +189,7 @@ inline double Roundf(double f)
}
-/// Fast conversion of float [0...1] to 0 ... 65535
+// Fast conversion of float [0...1] to 0 ... 65535
inline int NormalizedToWord(float f)
{
f = FloatMax(f, 0.0F);
@@ -197,14 +197,14 @@ inline int NormalizedToWord(float f)
return RoundfToIntPos(f * 65535.0f);
}
-/// Fast conversion of float [0...1] to 0 ... 65535
+// Fast conversion of float [0...1] to 0 ... 65535
inline float WordToNormalized(int p)
{
AssertIf(p < 0 || p > 65535);
return (float)p / 65535.0F;
}
-/// Fast conversion of float [0...1] to 0 ... 255
+// Fast conversion of float [0...1] to 0 ... 255
inline int NormalizedToByte(float f)
{
f = FloatMax(f, 0.0F);
@@ -212,7 +212,7 @@ inline int NormalizedToByte(float f)
return RoundfToIntPos(f * 255.0f);
}
-/// Fast conversion of float [0...1] to 0 ... 255
+// Fast conversion of float [0...1] to 0 ... 255
inline float ByteToNormalized(int p)
{
AssertIf(p < 0 || p > 255);
@@ -249,7 +249,7 @@ inline bool CompareApproximately(float f0, float f1, float epsilon = 0.000001F)
return dist < epsilon;
}
-/// CopySignf () returns x with its sign changed to y's.
+// CopySignf () returns x with its sign changed to y's.
inline float CopySignf(float x, float y)
{
union
@@ -389,17 +389,17 @@ inline bool IsFinite(const double& value)
inline float InvSqrt(float p) { return 1.0F / sqrt(p); }
inline float Sqrt(float p) { return sqrt(p); }
-/// - Almost highest precision sqrt
-/// - Returns 0 if value is 0 or -1
-/// inline float FastSqrt (float value)
+// - Almost highest precision sqrt
+// - Returns 0 if value is 0 or -1
+// inline float FastSqrt (float value)
-/// - Almost highest precision inv sqrt
-/// - if value == 0 or -0 it returns 0.
-/// inline float FastInvSqrt (float value)
+// - Almost highest precision inv sqrt
+// - if value == 0 or -0 it returns 0.
+// inline float FastInvSqrt (float value)
-/// - Low precision inv sqrt approximately
-/// - if value == 0 or -0 it returns nan or undefined
-/// inline float FastestInvSqrt (float value)
+// - Low precision inv sqrt approximately
+// - if value == 0 or -0 it returns nan or undefined
+// inline float FastestInvSqrt (float value)
#if defined(__ppc__) || defined(SN_TARGET_PS3)
@@ -426,8 +426,8 @@ inline float FastSqrt(float x)
return x;
}
#else
-/// - Accurate to 1 bit precision
-/// - returns zero if x is zero
+// - Accurate to 1 bit precision
+// - returns zero if x is zero
inline float FastSqrt(float x)
{
const float half = 0.5;
@@ -459,8 +459,8 @@ inline float FastSqrt(float x)
}
#endif
-/// - Accurate to 1 bit precision
-/// - returns zero if f is zero
+// - Accurate to 1 bit precision
+// - returns zero if f is zero
inline float FastInvSqrt(float f)
{
float result;
@@ -486,7 +486,7 @@ inline float FastInvSqrt(float f)
return result;
}
-/// Fast inverse sqrt function
+// Fast inverse sqrt function
inline float FastestInvSqrt(float value)
{
#if defined (__ppc__) && (defined (__MWERKS__) || defined(SN_TARGET_PS3))
diff --git a/Runtime/Math/Rect.h b/Runtime/Math/Rect.h
index 3b4f16c..dbd147c 100644
--- a/Runtime/Math/Rect.h
+++ b/Runtime/Math/Rect.h
@@ -3,7 +3,7 @@
#include "Vector2.h"
-/// A rectangle.
+// A rectangle.
template <typename T>
class RectT
{
@@ -11,21 +11,21 @@ public:
typedef RectT<T> RectType;
typedef float BaseType;
- T x; ///< Rectangle x coordinate.
- T y; ///< Rectangle y coordinate.
- T width; ///< Rectangle width.
- T height; ///< Rectangle height.
+ T x; //< Rectangle x coordinate.
+ T y; //< Rectangle y coordinate.
+ T width; //< Rectangle width.
+ T height; //< Rectangle height.
inline static const char* GetTypeString();
inline static bool IsAnimationChannel() { return false; }
inline static bool MightContainPPtr() { return false; }
- /// Create a empty rectangle.
+ // Create a empty rectangle.
RectT()
{
Reset();
}
- /// Create a new rectangle.
+ // Create a new rectangle.
RectT(T inX, T inY, T iWidth, T iHeight)
{
x = inX; width = iWidth;
@@ -43,7 +43,7 @@ public:
T GetXMax() const { return x + width; }
T GetYMax() const { return y + height; }
- /// Return true if rectangle is empty.
+ // Return true if rectangle is empty.
inline bool IsEmpty() const { return width <= 0 || height <= 0; }
inline void SetPosition(const Vector2f& position) { x = position.x; y = position.y; }
@@ -51,10 +51,10 @@ public:
inline void SetSize(const Vector2f& size) { width = size.x; height = size.y; }
inline Vector2f GetSize() const { return Vector2f(width, height); }
- /// Resets the rectangle
+ // Resets the rectangle
inline void Reset() { x = y = width = height = 0; }
- /// Sets the rectangle
+ // Sets the rectangle
inline void Set(T inX, T inY, T iWidth, T iHeight)
{
x = inX; width = iWidth;
@@ -63,11 +63,11 @@ public:
inline void Scale(T dx, T dy) { x *= dx; width *= dx; y *= dy; height *= dy; }
- /// Set Center position of rectangle (size stays the same)
+ // Set Center position of rectangle (size stays the same)
void SetCenterPos(T cx, T cy) { x = cx - width / 2; y = cy - height / 2; }
Vector2f GetCenterPos() const { return Vector2f(x + (BaseType)width / 2, y + (BaseType)height / 2); }
- /// Ensure this is inside the rect r.
+ // Ensure this is inside the rect r.
void Clamp(const RectType &r)
{
T x2 = x + width;
@@ -87,19 +87,19 @@ public:
if (height < 0) height = 0;
}
- /// Move rectangle by deltaX, deltaY.
+ // Move rectangle by deltaX, deltaY.
inline void Move(T dX, T dY) { x += dX; y += dY; }
- /// Return the width of rectangle.
+ // Return the width of rectangle.
inline T Width() const { return width; }
- /// Return the height of rectangle.
+ // Return the height of rectangle.
inline T Height() const { return height; }
- /// Return true if a point lies within rectangle bounds.
+ // Return true if a point lies within rectangle bounds.
inline bool Contains(T px, T py) const { return (px >= x) && (px < x + width) && (py >= y) && (py < y + height); }
inline bool Contains(const Vector2f& p) const { return Contains(p.x, p.y); }
- /// Return true if a relative point lies within rectangle bounds.
+ // Return true if a relative point lies within rectangle bounds.
inline bool ContainsRel(T x, T y) const
{
return (x >= 0) && (x < Width()) && (y >= 0) && (y < Height());
@@ -115,7 +115,7 @@ public:
return !disjoint;
}
- /// Normalize a rectangle such that xmin <= xmax and ymin <= ymax.
+ // Normalize a rectangle such that xmin <= xmax and ymin <= ymax.
inline void Normalize()
{
width = std::max<T>(width, 0);
@@ -138,7 +138,7 @@ inline bool CompareApproximately(const Rectf& lhs, const Rectf& rhs)
CompareApproximately(lhs.width, rhs.width) && CompareApproximately(lhs.height, rhs.height);
}
-/// Make a rect with width & height
+// Make a rect with width & height
template<typename T>
inline RectT<T> MinMaxRect(T minx, T miny, T maxx, T maxy) { return RectT<T>(minx, miny, maxx - minx, maxy - miny); }
diff --git a/Runtime/Math/Vector2.h b/Runtime/Math/Vector2.h
index 01fa015..62f4659 100644
--- a/Runtime/Math/Vector2.h
+++ b/Runtime/Math/Vector2.h
@@ -55,16 +55,16 @@ public:
//inline Vector2f operator / (const Vector2f& inV, float s) { Vector2f temp(inV); temp /= s; return temp; }
//inline Vector2f Inverse(const Vector2f& inVec) { return Vector2f(1.0F / inVec.x, 1.0F / inVec.y); }
//
-//// Normalizes a vector, asserts if the vector can be normalized
+/// Normalizes a vector, asserts if the vector can be normalized
//inline Vector2f Normalize(const Vector2f& inV) { return inV / Magnitude(inV); }
-//// Normalizes a vector, returns default vector if it can't be normalized
+/// Normalizes a vector, returns default vector if it can't be normalized
//inline Vector2f NormalizeSafe(const Vector2f& inV, const Vector2f& defaultV = Vector2f::zero);
//
//inline Vector2f Lerp(const Vector2f& from, const Vector2f& to, float t) { return to * t + from * (1.0f - t); }
//
-//// Returns a vector with the smaller of every component from v0 and v1
+/// Returns a vector with the smaller of every component from v0 and v1
//inline Vector2f min(const Vector2f& lhs, const Vector2f& rhs) { return Vector2f(std::min(lhs.x, rhs.x), std::min(lhs.y, rhs.y)); }
-//// Returns a vector with the larger of every component from v0 and v1
+/// Returns a vector with the larger of every component from v0 and v1
//inline Vector2f max(const Vector2f& lhs, const Vector2f& rhs) { return Vector2f(std::max(lhs.x, rhs.x), std::max(lhs.y, rhs.y)); }
//
//bool CompareApproximately(const Vector2f& inV0, const Vector2f& inV1, float inMaxDist = Vector2f::epsilon);
@@ -79,7 +79,7 @@ public:
// return CompareApproximately(SqrMagnitude(vec), 1.0F, epsilon);
//}
//
-///// Returns the abs of every component of the vector
+//// Returns the abs of every component of the vector
//inline Vector2f Abs(const Vector2f& v) { return Vector2f(Abs(v.x), Abs(v.y)); }
//
//inline bool IsFinite(const Vector2f& f)