How to generate a set of connected line segment that when we randomly choose any two points and plus y feet above it, so they could mutually see each other?

1 view (last 30 days)
The question should be specified like this. I need to randomly generate a set of connected line segment. Any two points that is y feet above it could be connected without intersecting with the connected line segment.
Thanks. Your answer will help me a lot!
  4 Comments
toby
toby on 24 Feb 2014
Thanks for your replies!
I attached the image. It shows that there are two random points (A and B) on the "set line segment". y feet above A could see y feet above B. It is like two y-feet high men standing on the road, and they could see each other without obstructing by any point of the road.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 24 Feb 2014
OK. Point A and point B are on the thick zig zag line, and you have two points above them at (xa, ya+y), and at (xb, yb+y). A line could be drawn between those two points that may or may not intersect the zig zag, depending on what y is and what the zig zag does in between xa and xb.
But I'm not exactly sure what the question is. Do you want to know if the line intersects the zig zag or not? Do you want the height (y value) for all the points on a line connecting (xa, ya+y) to (xb, yb+y)?
  3 Comments
Image Analyst
Image Analyst on 24 Feb 2014
Can't you just calculate the slope between then and then find the y value of the connecting line for each zig zag element location and see if the connecting line is always above? It's just simple algebra.
toby
toby on 24 Feb 2014
Yes, I know that is a way to check it meets the requirement or not. But I want to define the feasible region of x and y coordinates for every turning point of zig zag, so that I could always generate a feasible zig zag.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!