SFML community forums

Help => Graphics => Topic started by: jdm1891 on December 13, 2016, 02:37:31 am

Title: Check if line intersects shape
Post by: jdm1891 on December 13, 2016, 02:37:31 am
I have a a sf::VertexArray that makes a line, and I have a shape(sf::Shape).

How can I check if the line goes through the shape?

Note though because I am using the sf::Shape class and not a specific shape so I would prefer to only use getPoint() and getPointCount() to do it

This is for lighting so it is very important that I don't use a rectangle. The reason I want to do this is to find where the light needs to stop being drawn(I have it as a mask over the world), which is when the light intersects an object. If you know a better way to do this please tell me!
Title: Re: Check if line intersects shape
Post by: Laurent on December 13, 2016, 07:19:22 am
This is the kind of question that is immediately answered with Google. You didn't even search, did you?

https://www.google.com/search?q=line+polygon+intersection