Message Boards Message Boards

0
|
1226 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Determine if the line passes through the area of the rectangle

Posted 1 year ago

How can I do the calculation to know if the line is passing through the rectangle (obstacle), since I only know the position of sta1 and sta2 and I also know the xmin, xmax and ymin, ymax of the rectangle?

enter image description here

sta1 position(x,y) = (1,5) sta2 position(x,y) = (5,1)

retangle xmin = 3 retangle xmax = 4 retangle ymin = 2 retangle ymax = 3

POSTED BY: André Demori
Posted 1 year ago

Hint

FindInstance[y==-1*x+6&&3<=x<=4&&2<=y<=3,{x,y}]

returns

{{x->4,y->2}}

and

FindInstance[y==-1*x+8&&3<=x<=4&&2<=y<=3,{x,y}]

returns

{}

Can you construct the input needed by Findinstance from the information you have about the points and test whether the result returned from FindInstance is an empty list or not?

POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract