Reputation: 389
I am having trouble figuring this out, I have 2 points A & B, I need to draw a straight line, and then see if this line intersects with circle C
What is the best way to do this? (I am new to Postgres so details would be super appreciated), steps to do:
Upvotes: 1
Views: 173
Reputation: 246013
You can use ST_MakeLine
to create a line from two points and ST_Intersects
to see if it intersects with the circle.
But it is probably easier to use the <->
distance operator to see if the distance of the line from the center is less than the radius.
Upvotes: 3