unit axis intercepts [solved]

new topic     » topic index » view thread      » older message » newer message

I've written a natty little routine which bisects a bezier curve into sub-pixel fragments and that
part is working fine, and once I've got {x1,y1} and {x2,y2} within a 1x1 pixel square, I want to
know whether they intersect the unit axis, for which "ceil(min(x1,x2))!=ceil(max(x1,x2))" and the
same for the unit y axis is fine. However, I also want to know where it intercepts the unit axis,
which btw is floor(max(x1,x2)), and also incidentally I'm happy with the edge cases of 0.1..1 not
being an intercept but its partner 1..1.9 being one, and wouldn't want both deemed one anyway.
Once it is that small, I think it is safe to treat the curve fragment as a straight line.

I'm sure that's all clear as mud.

So I've got minx, maxx, unitx, ditto y, but in want of a hitux and hituy. I think the problem is
(flat|steep) * (\|/) * (up|down or left|right) and I'm currently staring at (a roughly estimated)
40 or so glitches in a test set of 625 cases and a brain clogged with min/max/ceil/floor/abs when
maybe I don't really need or want any of them?? I somehow believe there is a dirt-simple solution
itching to get out, but I just can't see it.

To recap/summarise, given some {x1,y1}, {x2,y2}: where does it hit a straddled whole x, ditto y?
You cannot make any assumptions about the first point being left or right or above or below the
other one, but you can assume they are strictly less than 1 apart, in both directions.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu