13#include "IGraphicsConstants.h"
18BEGIN_IGRAPHICS_NAMESPACE
23#define MakeIRect(a) IRECT(a##_X, a##_Y, a##_X + a##_W, a##_Y + a##_H)
24#define MakeIRectHOffset(a, xoffs) IRECT(a##_X + xoffs, a##_Y, a##_X + a##_W + xoffs, a##_Y + a##_H)
25#define MakeIRectVOffset(a, yoffs) IRECT(a##_X, a##_Y + yoffs, a##_X + a##_W, a##_Y + a##_H + yoffs)
26#define MakeIRectHVOffset(a, xoffs, yoffs) IRECT(a##_X + xoffs, a##_Y + yoffs, a##_X + a##_W + xoffs, a##_Y + a##_H + yoffs)
28static double GetTimestamp()
30 static auto start = std::chrono::steady_clock::now();
31 return std::chrono::duration<double>(std::chrono::steady_clock::now() - start).count();
35inline T DegToRad(T degrees)
37 return static_cast<T
>(iplug::PI) * (degrees /
static_cast<T
>(180.0));
41inline T RadToDeg(T radians)
43 return radians /
static_cast<T
>(iplug::PI) *
static_cast<T
>(180.0);
54static inline void RadialPoints(
float angleDegrees,
float cx,
float cy,
float rMin,
float rMax,
int nPoints,
float data[][2])
56 const float angleRadians = DegToRad(angleDegrees - 90.f);
57 const float sinV = std::sin(angleRadians);
58 const float cosV = std::cos(angleRadians);
60 for(
auto i = 0; i < nPoints; i++)
62 const float r = rMin+(rMax-rMin) * (
float) i / float (nPoints-1);
63 data[i][0] = (cx + r * cosV);
64 data[i][1] = (cy + r * sinV);
74 float m = d.x * e.y - d.y * e.x;
76 float epsilon = 1e-8f;
77 if (std::abs(m) < epsilon)
79 return -(d.x * b.y - d.y * b.x) / m;
82END_IGRAPHICS_NAMESPACE
IPlug Constant definitions, Types, magic numbers.
Encapsulate an xy point in one struct.