That's raytracing. You can do LOS by raycasting only at line segments and points of blocking shapes, especially in 2D, which is the original post's concern. https://ncase.me/sight-and-light/
Absolutely not. There's uh, a lot of tutorials on YouTube about how to go about implementing this kinda thing, depending on the kind of game (top-down 2d, vs 3d etc). Sorry don't have time to do a full write up lol.
But this approach actually also works and delivers different results in 2D space, than doing what you probably have in mind.
This approach in 3D would basically mean live raycasting rendering, which is something I would like to try in the future.