2
$\begingroup$

Given that I have the array of points,

{{680*4, 509*4}, {739*4, 622*4}, {644*4, 741*4}, {606*4, 
  856*4}, {749*4, 474*4}, {977*4, 542*4}, {601*4, 481*4}, {584*4, 
  604*4}, {866*4, 667*4}}

what would be the best way to draw all the possible lines between this set of points and overlay them onto an image?

$\endgroup$
5
  • 1
    $\begingroup$ Graphics@Line@Subsets[#, {2}] &@ array and then use Show to cobine it with image. $\endgroup$
    – Kuba
    Commented Jan 21, 2015 at 12:26
  • 1
    $\begingroup$ @Kuba straightforward, but why not answer? $\endgroup$
    – Yves Klett
    Commented Jan 21, 2015 at 12:27
  • $\begingroup$ @Kuba Is there a place where I can learn to use this kind of shorthand? ATM I am unsure of the correct method to parse this kind of code. $\endgroup$
    – March Ho
    Commented Jan 21, 2015 at 12:28
  • 1
    $\begingroup$ @MarchHo Here ;) common pitfalls $\endgroup$
    – Kuba
    Commented Jan 21, 2015 at 12:31
  • $\begingroup$ @YvesKlett ok, done. :) $\endgroup$
    – Kuba
    Commented Jan 21, 2015 at 12:37

1 Answer 1

8
$\begingroup$
array = {{680*4, 509*4}, {739*4, 622*4}, {644*4, 741*4}, {606*4, 
   856*4}, {749*4, 474*4}, {977*4, 542*4}, {601*4, 481*4}, {584*4, 
   604*4}, {866*4, 667*4}};

pic = ImageResize[ExampleData[{"TestImage", "Lena"}], {4000}];


Show[{
  pic,
  Graphics[{Yellow, Line@Subsets[array, {2}] }]
  }, ImageSize -> 400]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.