How do I find the nearest grid point of a bezier path as it intersects the document grid?

I am writing a script to create a linear copy of of a bezier path. I need to know where the path crosses the grid in-between the anchor points. Not sure if this can be calculated or not. Hoping you guys can help.

example linear path on grid from bezier curve path

  • Read pomax bezier info
    – joojaa
    Jul 16, 2021 at 14:22
  • Thanks for the great link, reading the information now.
    – Valerie
    Jul 16, 2021 at 14:28
  • The more hands on, graphic designer solution would be to fill the Bezier shape, rasterize it at a fitting low resolution without anti-aliasing and then auto-trace it. But I don't know if you need this for an aesthetic or more scientific purpose?
    – Wolff
    Jul 16, 2021 at 14:36
  • Thanks @wolff that's a very interesting idea I hadn't thought of. Not sure if the result will be scientific enough for what I need (nearest grid point along/across each grid line), but I'll definitely give it a shot.
    – Valerie
    Jul 16, 2021 at 14:57
  • I just tried to make a 1 inch grid and rasterize a Bezier shape to 1 ppi and it seems to be accurate. Check out this screenshot. And is it "scientific" enough? I have no way of telling, but Illustrator is a program you use to rasterize vector which essentially is what you want to do, so why shouldn't it be? The problem is the auto-tracing though. I can't get a good result. Could be because of the low ppi. I tried upscaling the image before tracing, which works better but with many small inaccuracies. Strangely enough ...
    – Wolff
    Jul 16, 2021 at 16:47


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.