path-intersection.cpp revision a9e97816d32eb4bb1a9b34ad9633c7e9749b5c14
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould//for path_direction:
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmnamespace Geom {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * This function computes the winding of the path, given a reference point.
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Positive values correspond to counter-clockwise in the mathematical coordinate system,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * and clockwise in screen coordinates. This particular implementation casts a ray in
1b3a8414f17dc95fc921d999ea715c99d10dd4aaAlex Valavanis * the positive x direction. It iterates the path, checking for intersection with the
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * bounding boxes. If an intersection is found, the initial/final Y value of the curve is
035e109c2dce9f6a9552f75d09b1573311d02546tweenk * used to derive a delta on the winding value. If the point is within the bounding box,
035e109c2dce9f6a9552f75d09b1573311d02546tweenk * the curve specific winding function is called.
035e109c2dce9f6a9552f75d09b1573311d02546tweenk //start on a segment which is not a horizontal line with y = p[y]
035e109c2dce9f6a9552f75d09b1573311d02546tweenk for(Path::const_iterator iter = path.begin(); ; ++iter) {
035e109c2dce9f6a9552f75d09b1573311d02546tweenk if(iter->initialPoint()[Y]!=p[Y]) { start = iter; break; }
035e109c2dce9f6a9552f75d09b1573311d02546tweenk if(iter->finalPoint()[Y]!=p[Y]) { start = iter; break; }
035e109c2dce9f6a9552f75d09b1573311d02546tweenk if(iter->boundsFast()->height()!=0.){ start = iter; break; }
035e109c2dce9f6a9552f75d09b1573311d02546tweenk unsigned cnt = 0;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm for (Path::const_iterator iter = start; iter != start || starting
23d859f2ce09c04ed802cb4912cc9c50f512f0a2bgk ; ++iter, iter = (iter == path.end_closed()) ? path.begin() : iter )
ae22ad7adc4a7a418e71f5dbab8c1f0f7f464562johanengelen if(cnt > path.size()) return wind; //some bug makes this required
035e109c2dce9f6a9552f75d09b1573311d02546tweenk Coord x = p[X], y = p[Y];
035e109c2dce9f6a9552f75d09b1573311d02546tweenk if(x > bounds.right() || !bounds[Y].contains(y)) continue; //ray doesn't intersect box
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm // if y is included, these will have opposite values, giving order.
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm // ray goes through bbox
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm // winding delta determined by position of endpoints
738092bcf0d040b2431137e191dfd7cf3ce3afadJohan Engelen wind += int(c); // GT = counter-clockwise = 1; LT = clockwise = -1; EQ = not-included = 0
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm //std::cout << int(c) << " ";
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm //inside bbox, use custom per-curve winding thingie
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak //std::cout << "n" << delt << " ";
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak //Handling the special case of an endpoint on the ray:
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak if(final[Y] == y) {
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak //Traverse segments until it breaks away from y
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm //99.9% of the time this will happen the first go
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith for(; ; next++) {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith if(next == path.end_closed()) next = path.begin();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm //TODO: X considerations
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen //It has diverged
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak if(cmp(y, next->valueAt(fudge, Y)) == initial_to_ray) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm wind += int(c);
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith //std::cout << "!!!!!" << int(c) << " ";
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith iter = next; // No increment, as the rest of the thing hasn't been counted.
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen //Is a continuation through the ray, so counts windingwise
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm //std::cout << "!!!!!" << int(c) << " ";
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith //Looks like it looped, which means everything's flat
260ccdd5a6e2a22e13ce13a71bd292da1be3e1adAlex Valavanis * This function should only be applied to simple paths (regions), as otherwise
02db7fad736ff0812658ef9c5f82ac2e64ffdefcAlex Valavanis * a boolean winding direction is undefined. It returns true for fill, false for
02db7fad736ff0812658ef9c5f82ac2e64ffdefcAlex Valavanis * hole. Defaults to using the sign of area when it reaches funny cases.
02db7fad736ff0812658ef9c5f82ac2e64ffdefcAlex Valavanis if(p.empty()) return false;
02db7fad736ff0812658ef9c5f82ac2e64ffdefcAlex Valavanis //could probably be more efficient, but this is a quick job
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith double y = p.initialPoint()[Y];
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith double x = p.initialPoint()[X];
02db7fad736ff0812658ef9c5f82ac2e64ffdefcAlex Valavanis Cmp final_to_ray = cmp(p[i].finalPoint()[Y], y);
02db7fad736ff0812658ef9c5f82ac2e64ffdefcAlex Valavanis Cmp initial_to_ray = cmp(p[i].initialPoint()[Y], y);
02db7fad736ff0812658ef9c5f82ac2e64ffdefcAlex Valavanis // if y is included, these will have opposite values, giving order.
02db7fad736ff0812658ef9c5f82ac2e64ffdefcAlex Valavanis } else if(final_to_ray == EQUAL_TO) goto doh;
260ccdd5a6e2a22e13ce13a71bd292da1be3e1adAlex Valavanis //Otherwise fallback on area
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith//pair intersect code based on njh's pair-intersect
8e7d13ca30e4b9671afc47f03dc11affd5507077Alex Valavanis/** A little sugar for appending a list to another */
8e7d13ca30e4b9671afc47f03dc11affd5507077Alex Valavanistemplate<typename T>
8e7d13ca30e4b9671afc47f03dc11affd5507077Alex Valavanisvoid append(T &a, T const &b) {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith * Finds the intersection between the lines defined by A0 & A1, and B0 & B1.
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith * Returns through the last 3 parameters, returning the t-values on the lines
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith * and the cross-product of the deltas (a useful byproduct). The return value
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith * indicates if the time values are within their proper range on the line segments.
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelenlinear_intersect(Point A0, Point A1, Point B0, Point B1,
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen // kramers rule as cross products
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen return false;
607ec3f31779845d307f157ff34472da27b8bdbcjohanengelen return tA >= 0. && tA <= 1. && tB >= 0. && tB <= 1.;
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelentypedef union dbl_64{
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen else if(s.i64-- < 0)
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith Curve const &B, double &t) {
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen for(int i = 0; i < 4; i++) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm we want to solve
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak J*(x1 - x0) = f(x0)
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak |dA(s)[0] -dB(t)[0]| (X1 - X0) = A(s) - B(t)
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak |dA(s)[1] -dB(t)[1]|
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak // We're using the standard transformation matricies, which is numerically rather poor. Much better to solve the equation using elimination.
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm // At this point we could do a line search
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if(0) { // the GSL version is more accurate, but taints this with GPL
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen struct rparams p = {A, B};
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen gsl_multiroot_function f = {&intersect_polish_f, n, &p};
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak const gsl_multiroot_fsolver_type *T = gsl_multiroot_fsolver_hybrids;
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak gsl_multiroot_fsolver *sol = gsl_multiroot_fsolver_alloc (T, 2);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * This uses the local bounds functions of curves to generically intersect two.
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith * It passes in the curves, time intervals, and keeps track of depth, while
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * returning the results through the Crossings parameter.
0d00bc9f32167e81375a4be524572b27e2894ee4John Smithvoid pair_intersect(Curve const & A, double Al, double Ah,
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz // std::cout << depth << "(" << Al << ", " << Ah << ")\n";
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz if (!Ar) return;
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz if (!Br) return;
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz //Checks the general linearity of the function
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz if((depth > 12)) { // || (A.boundsLocal(Interval(Al, Ah), 1).maxExtent() < 0.1
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz //&& B.boundsLocal(Interval(Bl, Bh), 1).maxExtent() < 0.1)) {
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz if(linear_intersect(A.pointAt(Al), A.pointAt(Ah),
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelenCrossings pair_intersect(Curve const & A, Interval const &Ad,
32143ea5edb30f496040c1f24538e38d9453fc06Johan B. C. Engelen pair_intersect(A, Ad.min(), Ad.max(), B, Bd.min(), Bd.max(), ret);
cd392fe863cb06ba22f2b54bdb96ef3a6ee6bc5bJohan Engelen/** A simple wrapper around pair_intersect */
cd392fe863cb06ba22f2b54bdb96ef3a6ee6bc5bJohan EngelenCrossings SimpleCrosser::crossings(Curve const &a, Curve const &b) {
90a3966dd44e306d23febc15ebd65cde07d7a4ddTed Gould//same as below but curves not paths
90a3966dd44e306d23febc15ebd65cde07d7a4ddTed Gouldvoid mono_intersect(Curve const &A, double Al, double Ah,
aea6c63514922bfc46ced140fa2877576aa21203johanengelen Crossings &ret, double tol = 0.1, unsigned depth = 0) {
90a3966dd44e306d23febc15ebd65cde07d7a4ddTed Gould //std::cout << " " << depth << "[" << Al << ", " << Ah << "]" << "[" << Bl << ", " << Bh << "]";
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen //inline code that this implies? (without rect/interval construction)
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen if(!Ar.intersects(Br) || A0 == A1 || B0 == B1) return;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if(depth > 12 || (Ar.maxExtent() < tol && Ar.maxExtent() < tol)) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmCrossings mono_intersect(Curve const & A, Interval const &Ad,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm mono_intersect(A, Ad.min(), Ad.max(), B, Bd.min(), Bd.max(), ret);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Takes two paths and time ranges on them, with the invariant that the
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * paths are monotonic on the range. Splits A when the linear intersection
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith * doesn't exist or is inaccurate. Uses the fact that it is monotonic to
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * do very fast local bounds.
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen Crossings &ret, double /*tol*/, unsigned depth = 0) {
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen std::cout << " " << depth << "[" << Al << ", " << Ah << "]" << "[" << Bl << ", " << Bh << "]";
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen Point A0 = A.pointAt(Al), A1 = A.pointAt(Ah),
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen //inline code that this implies? (without rect/interval construction)
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen Rect Ar = Rect(A0, A1), Br = Rect(B0, B1);
ae22ad7adc4a7a418e71f5dbab8c1f0f7f464562johanengelen if(depth > 12 || (Ar.maxExtent() < 0.1 && Ar.maxExtent() < 0.1)) {
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz/** This returns the times when the x or y derivative is 0 in the curve. */
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruzstd::vector<double> curve_mono_splits(Curve const &d) {
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz/** Convenience function to add a value to each entry in a vector of doubles. */
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruzstd::vector<double> offset_doubles(std::vector<double> const &x, double offs) {
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz for(unsigned i = 0; i < x.size(); i++) {
dd0ae0a28fda34d3805f7fe6deece97c4192910aJohan B. C. Engelen * Finds all the monotonic splits for a path. Only includes the split between
dd0ae0a28fda34d3805f7fe6deece97c4192910aJohan B. C. Engelen * curves if they switch derivative directions at that point.
dd0ae0a28fda34d3805f7fe6deece97c4192910aJohan B. C. Engelenstd::vector<double> path_mono_splits(Path const &p) {
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz bool pdx=2, pdy=2; //Previous derivative direction
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz for(unsigned i = 0; i < p.size(); i++) {
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz std::vector<double> spl = offset_doubles(curve_mono_splits(p[i]), i);
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz bool dx = p[i].initialPoint()[X] > (spl.empty()? p[i].finalPoint()[X] :
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz bool dy = p[i].initialPoint()[Y] > (spl.empty()? p[i].finalPoint()[Y] :
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz //The direction changed, include the split time
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Applies path_mono_splits to multiple paths, and returns the results such that
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * time-set i corresponds to Path i.
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmstd::vector<std::vector<double> > paths_mono_splits(std::vector<Path> const &ps) {
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz * Processes the bounds for a list of paths and a list of splits on them, yielding a list of rects for each.
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen * Each entry i corresponds to path i of the input. The number of rects in each entry is guaranteed to be the
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen * number of splits for that path, subtracted by one.
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelenstd::vector<std::vector<Rect> > split_bounds(std::vector<Path> const &p, std::vector<std::vector<double> > splits) {
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen for(unsigned i = 0; i < p.size(); i++) {
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen res.push_back(Rect(p[i].pointAt(splits[i][j-1]), p[i].pointAt(splits[i][j])));
9dc68827cbd515262ecb8d5ae8547d9e82c72e00Jon A. Cruz * This is the main routine of "MonoCrosser", and implements a monotonic strategy on multiple curves.
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen * Finds crossings between two sets of paths, yielding a CrossingSet. [0, a.size()) of the return correspond
32143ea5edb30f496040c1f24538e38d9453fc06Johan B. C. Engelen * to the sorted crossings of a with paths of b. The rest of the return, [a.size(), a.size() + b.size()],
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen * corresponds to the sorted crossings of b with paths of a.
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen * This function does two sweeps, one on the bounds of each path, and after that cull, one on the curves within.
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen * This leads to a certain amount of code complexity, however, most of that is factored into the above functions
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelenCrossingSet MonoCrosser::crossings(std::vector<Path> const &a, std::vector<Path> const &b) {
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen if(b.empty()) return CrossingSet(a.size(), Crossings());
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen CrossingSet results(a.size() + b.size(), Crossings());
f4d474ff2d58b3d32dacd5feed0c164e8df4936cJon A. Cruz std::vector<std::vector<double> > splits_a = paths_mono_splits(a), splits_b = paths_mono_splits(b);
32143ea5edb30f496040c1f24538e38d9453fc06Johan B. C. Engelen std::vector<std::vector<Rect> > bounds_a = split_bounds(a, splits_a), bounds_b = split_bounds(b, splits_b);
9dc68827cbd515262ecb8d5ae8547d9e82c72e00Jon A. Cruz std::vector<Rect> bounds_a_union, bounds_b_union;
9dc68827cbd515262ecb8d5ae8547d9e82c72e00Jon A. Cruz for(unsigned i = 0; i < bounds_a.size(); i++) bounds_a_union.push_back(union_list(bounds_a[i]));
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen for(unsigned i = 0; i < bounds_b.size(); i++) bounds_b_union.push_back(union_list(bounds_b[i]));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm std::vector<std::vector<unsigned> > cull = sweep_bounds(bounds_a_union, bounds_b_union);
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen //Sweep of the monotonic portions
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen std::vector<std::vector<unsigned> > cull2 = sweep_bounds(bounds_a[i], bounds_b[j]);
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen for(unsigned lx = 0; lx < cull2[k].size(); lx++) {
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen mono_pair(a[i], splits_a[i][k-1], splits_a[i][k],
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen for(unsigned k = 0; k < res.size(); k++) { res[k].a = i; res[k].b = jc; }
90a3966dd44e306d23febc15ebd65cde07d7a4ddTed Gould/* This function is similar codewise to the MonoCrosser, the main difference is that it deals with
607ec3f31779845d307f157ff34472da27b8bdbcjohanengelen * only one set of paths and includes self intersection
607ec3f31779845d307f157ff34472da27b8bdbcjohanengelenCrossingSet crossings_among(std::vector<Path> const &p) {
607ec3f31779845d307f157ff34472da27b8bdbcjohanengelen CrossingSet results(p.size(), Crossings());
607ec3f31779845d307f157ff34472da27b8bdbcjohanengelen if(p.empty()) return results;
9dc68827cbd515262ecb8d5ae8547d9e82c72e00Jon A. Cruz std::vector<std::vector<double> > splits = paths_mono_splits(p);
9dc68827cbd515262ecb8d5ae8547d9e82c72e00Jon A. Cruz std::vector<std::vector<Rect> > prs = split_bounds(p, splits);
607ec3f31779845d307f157ff34472da27b8bdbcjohanengelen std::vector<Rect> rs;
607ec3f31779845d307f157ff34472da27b8bdbcjohanengelen for(unsigned i = 0; i < prs.size(); i++) rs.push_back(union_list(prs[i]));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm std::vector<std::vector<unsigned> > cull = sweep_bounds(rs);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm //we actually want to do the self-intersections, so add em in:
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm for(unsigned i = 0; i < cull.size(); i++) cull[i].push_back(i);
ba885512446fff2803585a4aaec34e7742841f05cilix for(unsigned i = 0; i < cull.size(); i++) {
ba885512446fff2803585a4aaec34e7742841f05cilix for(unsigned jx = 0; jx < cull[i].size(); jx++) {
ba885512446fff2803585a4aaec34e7742841f05cilix unsigned j = cull[i][jx];
ba885512446fff2803585a4aaec34e7742841f05cilix Crossings res;
ba885512446fff2803585a4aaec34e7742841f05cilix //Sweep of the monotonic portions
ba885512446fff2803585a4aaec34e7742841f05cilix std::vector<std::vector<unsigned> > cull2 = sweep_bounds(prs[i], prs[j]);
ba885512446fff2803585a4aaec34e7742841f05cilix for(unsigned k = 0; k < cull2.size(); k++) {
a4030d5ca449e7e384bc699cd249ee704faaeab0Chris Morgan for(unsigned lx = 0; lx < cull2[k].size(); lx++) {
for(unsigned k = 0; k < res.size(); k++) { res[k].a = i; res[k].b = j; }
return res;
for(unsigned i = 0; i <= p.size(); i++) {
std::vector<std::vector<Rect> > curves_split_bounds(Path const &p, std::vector<std::vector<double> > splits) {
for(unsigned i = 0; i < splits.size(); i++) {
for(unsigned i = 0; i < cull.size(); i++) {
res.clear();
for(unsigned k = 0; k < cull2.size(); k++) {
//if(fabs(int(i)-j) == 1 || fabs(int(i)-j) == p.size()-1) {
for(unsigned k = 0; k < res.size(); k++) {
//if(fabs(int(i)-j) == 1 || fabs(int(i)-j) == p.size()-1) {
return ret;
return results;