1
$\begingroup$

As the title says, I have a Line object like this:

Line[{{1,2,3},{4,5,6},...,{7,8,9}}]

and want to extract certain points. I have no clue how to do this. Thanks for help

$\endgroup$
1
  • 1
    $\begingroup$ Line[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}][[1, 1]] yields {1, 2, 3}. $\endgroup$ Commented Apr 26, 2018 at 14:33

1 Answer 1

4
$\begingroup$

Using the third argument of Extract:

ClearAll[extractPoints]
extractPoints = Extract[#, {1, ## & @@ #} & /@ #2, Point] &;

Example:

line = Line[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}];
extractPoints[line, {3, {1, 2}, {2, 3}}]

{Point[{7, 8, 9}], Point[2], Point[6]}

$\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.