Collision detection between circle or rect with line object?

Is it possible to somehow do a circle (or rect) object collision detection with a drawn line object with a strokeWidth somehow?

The only thing I can come up with is to draw rectangles, and then rotating them, placing them above the lines and the do the check… but this seems very complicated to me for such a “simple” thing. Can’t this be done more easily?

Any help welcome!

with physics (as a simulation problem) or without physics (as a comp geom problem)???

with physics:  construct the objects, add collision listener, respond

without physics:  SAT suggested if oriented rectangles involved, fe: https://bitbucket.org/RudenkoPaint/sat-lua

not recommended: as a “bitmap” problem…  render the objects into a texture with a blend mode that will “combine” their colors (like add, using pure red rect and pure green circle), then a bunch of display.colorSample()'s seeking for “yellow” (or any similar/related approach) = ugh

Thx for the fast reply and the details. The question was for a non-physics approach but for now I’m using physics until I find another (better) solution.

with physics (as a simulation problem) or without physics (as a comp geom problem)???

with physics:  construct the objects, add collision listener, respond

without physics:  SAT suggested if oriented rectangles involved, fe: https://bitbucket.org/RudenkoPaint/sat-lua

not recommended: as a “bitmap” problem…  render the objects into a texture with a blend mode that will “combine” their colors (like add, using pure red rect and pure green circle), then a bunch of display.colorSample()'s seeking for “yellow” (or any similar/related approach) = ugh

Thx for the fast reply and the details. The question was for a non-physics approach but for now I’m using physics until I find another (better) solution.