Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
blob_math.h
Go to the documentation of this file.
1#ifndef BLOBMATH_H
2#define BLOBMATH_H
3
4#include <concepts>
5#include <vector>
6
7class QPointF;
8
15class BlobMath {
16public:
23 static bool IsValidPoint(const QPointF &point);
24
35 template<typename T>
36 requires std::totally_ordered<T>
37 static T Clamp(const T &value, const T &min, const T &max) {
38 return qBound(min, value, max);
39 }
40
49 static std::vector<QPointF> GenerateCircularPoints(const QPointF &center, double radius, int num_of_points);
50
61 static QPointF CalculateBezierControlPoint(const QPointF &p0, const QPointF &p1, const QPointF &p2, float tension);
62};
63
64#endif // BLOBMATH_H
Provides static utility functions for mathematical operations related to the Blob animation.
Definition blob_math.h:15
static QPointF CalculateBezierControlPoint(const QPointF &p0, const QPointF &p1, const QPointF &p2, float tension)
Calculates a control point for a cubic Bezier segment, often used in Catmull-Rom splines....
Definition blob_math.cpp:42
static std::vector< QPointF > GenerateCircularPoints(const QPointF &center, double radius, int num_of_points)
Generates a specified number of points approximately distributed on a circle. Introduces slight rando...
Definition blob_math.cpp:21
static bool IsValidPoint(const QPointF &point)
Checks if a QPointF contains valid coordinate values. Verifies that coordinates are not NaN,...
Definition blob_math.cpp:7
static T Clamp(const T &value, const T &min, const T &max)
Clamps a value between a minimum and maximum limit. Requires the type T to be totally ordered (suppor...
Definition blob_math.h:37