inStar function
Is (x, y) inside a four-point star at (cx, cy), arms L long, turned rot?
q < 1 hollows the sides into thin spikes.
Implementation
bool inStar(
double x,
double y,
double cx,
double cy,
double L,
double rot, [
double q = 0.42,
]) {
if (L <= 0) return false;
final c = math.cos(rot);
final s = math.sin(rot);
final dx = x - cx;
final dy = y - cy;
final u = (dx * c + dy * s).abs() / L;
final v = (-dx * s + dy * c).abs() / L;
return u < 1 &&
v < 1 &&
math.min(u, v) <= math.pow(0.5, 1 / q) &&
math.pow(u, q) + math.pow(v, q) <= 1;
}