I would like to plot multiple, perhaps thousands of line segments on a single 2D plot in Mathematica. These line segments would be determined from an algorithm that would detected and save each segments endpoints. Once the algorithm has determined all the line segments within a finite 2D plot domain and range (e.g., x = 0,4 and y=0,0.5), I would like to plot them all on a single plot. Thanks for any suggestions.
4
votes
1 Answers
5
votes
Something like this?
detectEndPoints := {
{RandomReal[{0, 4}], RandomReal[{0, 5}]},
{RandomReal[{0, 4}], RandomReal[{0, 5}]}};
segments = Table[detectEndPoints , {1000}];
(* Graphics[Line /@ segments] Old Way *)
Graphics[Line @ segments] (* Valid since V6. Thanks @Mark McClure *)

HTH!
Edit
Re-reading your question, I am not sure whether you are generating a continuous line by determining one endpoint at a time, or a set of non-connected segments (as above). Just in case you are going the continuous way:
detectEndPointsV2[i_] := {Cos[2 Pi i 17/100], Sin[2 Pi 17 i/100]};
segments = Table[detectEndPointsV2[i], {i, 101}];
Graphics[Line@segments]
