Open Chillee opened 4 years ago
This a nice goal.
number of lattice points below a line.
We sort of have this in the number theory chapter (modsum).
Might be useful: https://github.com/hockyy/kactl/blob/main/content/geometry/PolygonStab.h https://github.com/hockyy/kactl/blob/main/content/geometry/AllPairPolygonStab.h https://github.com/hockyy/kactl/blob/main/content/geometry/CircleCover.h https://github.com/hockyy/kactl/blob/main/content/geometry/Visualize.h https://github.com/hockyy/kactl/blob/main/content/geometry/onionDecomposition.h https://github.com/hockyy/kactl/blob/main/content/geometry/RotationalSwap.h https://github.com/hockyy/kactl/blob/main/content/geometry/PolygonCount.h https://github.com/hockyy/kactl/blob/main/content/geometry/PolygonTriangulation.h https://github.com/hockyy/kactl/blob/main/content/geometry/TriangleCount.h https://github.com/hockyy/kactl/blob/main/content/geometry/CircleUnion.h
Tangent Circle Idea: Signature:
typedef pair<P, P> Line
// Returns the center of the tangent circle
P tangentCircle(Line a, Line b, double r) {
P o = intersect(a, b);
double agl = (b - o).angle() - (a - o).angle()
// Normalize this
if(agl > PI) agl = 2 * PI - agl;
P middle = a; middle.rotate(agl);
// If this method fails, lets just do (a - o).unit() + (b - o).unit()
middle = middle.unit() * (r / sin(agl / 2));
return middle;
}
o
, get the vector from o
to a.fi
, get the angle agl
from a.fi
to b.fi
, the length from o
to the circle's center is r / sin(agl / 2)
, get the vector in the middle of a.fi
and b.fi
from o
, get the center
I'd like to cram as much geometry as possible into KACTL. Perhaps not necessarily included by default, but some of these things would be nice to have. Taking lots of these from https://github.com/spaghetti-source/algorithm/tree/master/geometry