Extracting points from 3D plot that lie along an arbitrarily oriented lineHow to properly project a Graphics object consisting of line primitivesMapping Contour Plot onto ListPlot3D (or by using color variations)Region projection of multivariable interpolated functionParticle moving on curve which is the intersection of a surface and a planeRendering ListPlot3D SurfaceAnimate a circle “rolling” along a complicated 3D curveListPlot with a histogram of values on the vertical axisFinding optimal points in contours produced by ListContourPlotFinding average of attributed linesListPlot3D label is covered by surface in combined graphic

Is there a strong legal guarantee that the U.S. can give to another country that it won't attack them?

Is there any reason why MCU changed the Snap to Blip

RPI3B+: What are the four components below the HDMI connector called?

Does throwing a penny at a train stop the train?

Is a request to book a business flight ticket for a graduate student an unreasonable one?

Should disabled buttons give feedback when clicked?

Why isn't pressure filtration popular compared to vacuum filtration?

Was I subtly told to resign?

Are there any medieval light sources without fire?

What is a "shilicashe?"

The tensor product of two monoidal categories

How to trigger Authentification of Named Credential created via Apex

Is there any word for "disobedience to God"?

How quality assurance engineers test calculations?

Create a symmetric positive definite matrix (but not diagonal) with eigenvalues 1, 2, 4 - how to approach this problem?

How were Martello towers supposed to work?

How do you move up one folder in Finder?

Swapping "Good" and "Bad"

Is anyone advocating the promotion of homosexuality in UK schools?

Are there any sports for which the world's best player is female?

Word meaning to destroy books

Is English unusual in having no second person plural form?

If your plane is out-of-control, why does military training instruct releasing the joystick to neutralize controls?

How can I get a player to accept that they should stop trying to pull stunts without thinking them through first?



Extracting points from 3D plot that lie along an arbitrarily oriented line


How to properly project a Graphics object consisting of line primitivesMapping Contour Plot onto ListPlot3D (or by using color variations)Region projection of multivariable interpolated functionParticle moving on curve which is the intersection of a surface and a planeRendering ListPlot3D SurfaceAnimate a circle “rolling” along a complicated 3D curveListPlot with a histogram of values on the vertical axisFinding optimal points in contours produced by ListContourPlotFinding average of attributed linesListPlot3D label is covered by surface in combined graphic






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4












$begingroup$


Starting from i.e. the following 3d plot:



d = RandomReal[1, 100, 3];
ListPlot3D[d]


Is it possible to extract points that lay along an arbitrarily oriented line, i.e. like this:



Show[ListPlot3D[d], Graphics3D[Line[0, -.5, 1, 0.5, 1, 1]]]


?



EDIT: Z values of the plot along the line projected onto the x-y plane










share|improve this question











$endgroup$











  • $begingroup$
    Can you clarify a little, are you looking for the points that exactly intersect that line, or the z values of the plot along the line projected onto the x-y plane?
    $endgroup$
    – N.J.Evans
    8 hours ago










  • $begingroup$
    z values of the plot along the line projected onto the x-y plane
    $endgroup$
    – ATomek
    7 hours ago

















4












$begingroup$


Starting from i.e. the following 3d plot:



d = RandomReal[1, 100, 3];
ListPlot3D[d]


Is it possible to extract points that lay along an arbitrarily oriented line, i.e. like this:



Show[ListPlot3D[d], Graphics3D[Line[0, -.5, 1, 0.5, 1, 1]]]


?



EDIT: Z values of the plot along the line projected onto the x-y plane










share|improve this question











$endgroup$











  • $begingroup$
    Can you clarify a little, are you looking for the points that exactly intersect that line, or the z values of the plot along the line projected onto the x-y plane?
    $endgroup$
    – N.J.Evans
    8 hours ago










  • $begingroup$
    z values of the plot along the line projected onto the x-y plane
    $endgroup$
    – ATomek
    7 hours ago













4












4








4


1



$begingroup$


Starting from i.e. the following 3d plot:



d = RandomReal[1, 100, 3];
ListPlot3D[d]


Is it possible to extract points that lay along an arbitrarily oriented line, i.e. like this:



Show[ListPlot3D[d], Graphics3D[Line[0, -.5, 1, 0.5, 1, 1]]]


?



EDIT: Z values of the plot along the line projected onto the x-y plane










share|improve this question











$endgroup$




Starting from i.e. the following 3d plot:



d = RandomReal[1, 100, 3];
ListPlot3D[d]


Is it possible to extract points that lay along an arbitrarily oriented line, i.e. like this:



Show[ListPlot3D[d], Graphics3D[Line[0, -.5, 1, 0.5, 1, 1]]]


?



EDIT: Z values of the plot along the line projected onto the x-y plane







plotting list-manipulation graphics3d mesh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 7 hours ago









MelaGo

2,0161 gold badge1 silver badge7 bronze badges




2,0161 gold badge1 silver badge7 bronze badges










asked 8 hours ago









ATomekATomek

1048 bronze badges




1048 bronze badges











  • $begingroup$
    Can you clarify a little, are you looking for the points that exactly intersect that line, or the z values of the plot along the line projected onto the x-y plane?
    $endgroup$
    – N.J.Evans
    8 hours ago










  • $begingroup$
    z values of the plot along the line projected onto the x-y plane
    $endgroup$
    – ATomek
    7 hours ago
















  • $begingroup$
    Can you clarify a little, are you looking for the points that exactly intersect that line, or the z values of the plot along the line projected onto the x-y plane?
    $endgroup$
    – N.J.Evans
    8 hours ago










  • $begingroup$
    z values of the plot along the line projected onto the x-y plane
    $endgroup$
    – ATomek
    7 hours ago















$begingroup$
Can you clarify a little, are you looking for the points that exactly intersect that line, or the z values of the plot along the line projected onto the x-y plane?
$endgroup$
– N.J.Evans
8 hours ago




$begingroup$
Can you clarify a little, are you looking for the points that exactly intersect that line, or the z values of the plot along the line projected onto the x-y plane?
$endgroup$
– N.J.Evans
8 hours ago












$begingroup$
z values of the plot along the line projected onto the x-y plane
$endgroup$
– ATomek
7 hours ago




$begingroup$
z values of the plot along the line projected onto the x-y plane
$endgroup$
– ATomek
7 hours ago










2 Answers
2






active

oldest

votes


















4












$begingroup$

SeedRandom[5]
d = RandomReal[1, 100, 3];


You can use -.5 + 3 # - #2 & (or Function[x, y, -.5 + 3 x - y]) as the setting for MeshFunctions in ListPlot3D:



Show[lp3d = ListPlot3D[d, MeshFunctions -> -.5 + 3 # - #2 &, 
Mesh -> 0, MeshStyle -> Directive[Red, Thick], BoundaryStyle -> None],
Graphics3D[Thick , Blue, Line[0, -.5, 1, 0.5, 1, 1],
Opacity[.5, Yellow], EdgeForm @ None,
InfinitePlane[0, -.5, 0, 0, -.5, 1, 0.5, 1, 1]]]


enter image description here



To extract the points on the red line:



Cases[Normal @ lp3d, Line[x_] :> x, All][[1]]



0.492655, 0.977959, 0.559503, 0.491386, 0.973947,
   0.484116, 0.477966, 0.933211, 0.303948, 0.476062, 0.92816,
   0.451244, 0.459746, 0.878862, 0.640324, 0.457492,
0.872273,
   0.586974, 0.454029, 0.861943, 0.568448, 0.441994,
0.825895,
   0.39336, 0.396855, 0.690417, 0.20754, 0.395551, 0.686462,
   0.255852, 0.392548, 0.677572, 0.17963, 0.350269, 0.550753,
   0.612022, 0.341512, 0.524435, 0.760695, 0.313441,
0.440292,
   0.52727, 0.304016, 0.411343, 0.164743, 0.300216, 0.400556,
   0.123016, 0.293312, 0.379549, 0.431375, 0.279583, 0.33874,
   0.571648, 0.267421, 0.302245, 0.850239, 0.266698,
0.299818,
   0.85685, 0.226072, 0.177329, 0.737677, 0.217928, 0.152775,
   0.650557, 0.192837, 0.0784445, 0.831587, 0.187349,
0.0619587,
   0.854096, 0.174868, 0.024533, 0.602241







share|improve this answer











$endgroup$




















    0












    $begingroup$

    You can use the interpolation that ListPlot uses, which you can then evaluate at any point on the line (within the domain of the interpolation):



    zFN = Interpolation[d, InterpolationOrder -> 1, 
    "ExtrapolationHandler" -> Indeterminate &, "WarningMessage" -> False];

    ClearAll[xyline, zSect];
    xyline[x_] = (1 - 2 x), 2 x.0, -.5, 0.5, 1;
    zSect[x_] := zFN @@ xyline[x];

    zSect[0.25] (* test a value *)
    (* 0.654833 *)

    Show[
    ListPlot3D[d],
    ParametricPlot3D[Append[xyline[x], zSect[x]], x, 0, 1]
    ]


    enter image description here






    share|improve this answer









    $endgroup$















      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "387"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f201815%2fextracting-points-from-3d-plot-that-lie-along-an-arbitrarily-oriented-line%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      4












      $begingroup$

      SeedRandom[5]
      d = RandomReal[1, 100, 3];


      You can use -.5 + 3 # - #2 & (or Function[x, y, -.5 + 3 x - y]) as the setting for MeshFunctions in ListPlot3D:



      Show[lp3d = ListPlot3D[d, MeshFunctions -> -.5 + 3 # - #2 &, 
      Mesh -> 0, MeshStyle -> Directive[Red, Thick], BoundaryStyle -> None],
      Graphics3D[Thick , Blue, Line[0, -.5, 1, 0.5, 1, 1],
      Opacity[.5, Yellow], EdgeForm @ None,
      InfinitePlane[0, -.5, 0, 0, -.5, 1, 0.5, 1, 1]]]


      enter image description here



      To extract the points on the red line:



      Cases[Normal @ lp3d, Line[x_] :> x, All][[1]]



      0.492655, 0.977959, 0.559503, 0.491386, 0.973947,
         0.484116, 0.477966, 0.933211, 0.303948, 0.476062, 0.92816,
         0.451244, 0.459746, 0.878862, 0.640324, 0.457492,
      0.872273,
         0.586974, 0.454029, 0.861943, 0.568448, 0.441994,
      0.825895,
         0.39336, 0.396855, 0.690417, 0.20754, 0.395551, 0.686462,
         0.255852, 0.392548, 0.677572, 0.17963, 0.350269, 0.550753,
         0.612022, 0.341512, 0.524435, 0.760695, 0.313441,
      0.440292,
         0.52727, 0.304016, 0.411343, 0.164743, 0.300216, 0.400556,
         0.123016, 0.293312, 0.379549, 0.431375, 0.279583, 0.33874,
         0.571648, 0.267421, 0.302245, 0.850239, 0.266698,
      0.299818,
         0.85685, 0.226072, 0.177329, 0.737677, 0.217928, 0.152775,
         0.650557, 0.192837, 0.0784445, 0.831587, 0.187349,
      0.0619587,
         0.854096, 0.174868, 0.024533, 0.602241







      share|improve this answer











      $endgroup$

















        4












        $begingroup$

        SeedRandom[5]
        d = RandomReal[1, 100, 3];


        You can use -.5 + 3 # - #2 & (or Function[x, y, -.5 + 3 x - y]) as the setting for MeshFunctions in ListPlot3D:



        Show[lp3d = ListPlot3D[d, MeshFunctions -> -.5 + 3 # - #2 &, 
        Mesh -> 0, MeshStyle -> Directive[Red, Thick], BoundaryStyle -> None],
        Graphics3D[Thick , Blue, Line[0, -.5, 1, 0.5, 1, 1],
        Opacity[.5, Yellow], EdgeForm @ None,
        InfinitePlane[0, -.5, 0, 0, -.5, 1, 0.5, 1, 1]]]


        enter image description here



        To extract the points on the red line:



        Cases[Normal @ lp3d, Line[x_] :> x, All][[1]]



        0.492655, 0.977959, 0.559503, 0.491386, 0.973947,
           0.484116, 0.477966, 0.933211, 0.303948, 0.476062, 0.92816,
           0.451244, 0.459746, 0.878862, 0.640324, 0.457492,
        0.872273,
           0.586974, 0.454029, 0.861943, 0.568448, 0.441994,
        0.825895,
           0.39336, 0.396855, 0.690417, 0.20754, 0.395551, 0.686462,
           0.255852, 0.392548, 0.677572, 0.17963, 0.350269, 0.550753,
           0.612022, 0.341512, 0.524435, 0.760695, 0.313441,
        0.440292,
           0.52727, 0.304016, 0.411343, 0.164743, 0.300216, 0.400556,
           0.123016, 0.293312, 0.379549, 0.431375, 0.279583, 0.33874,
           0.571648, 0.267421, 0.302245, 0.850239, 0.266698,
        0.299818,
           0.85685, 0.226072, 0.177329, 0.737677, 0.217928, 0.152775,
           0.650557, 0.192837, 0.0784445, 0.831587, 0.187349,
        0.0619587,
           0.854096, 0.174868, 0.024533, 0.602241







        share|improve this answer











        $endgroup$















          4












          4








          4





          $begingroup$

          SeedRandom[5]
          d = RandomReal[1, 100, 3];


          You can use -.5 + 3 # - #2 & (or Function[x, y, -.5 + 3 x - y]) as the setting for MeshFunctions in ListPlot3D:



          Show[lp3d = ListPlot3D[d, MeshFunctions -> -.5 + 3 # - #2 &, 
          Mesh -> 0, MeshStyle -> Directive[Red, Thick], BoundaryStyle -> None],
          Graphics3D[Thick , Blue, Line[0, -.5, 1, 0.5, 1, 1],
          Opacity[.5, Yellow], EdgeForm @ None,
          InfinitePlane[0, -.5, 0, 0, -.5, 1, 0.5, 1, 1]]]


          enter image description here



          To extract the points on the red line:



          Cases[Normal @ lp3d, Line[x_] :> x, All][[1]]



          0.492655, 0.977959, 0.559503, 0.491386, 0.973947,
             0.484116, 0.477966, 0.933211, 0.303948, 0.476062, 0.92816,
             0.451244, 0.459746, 0.878862, 0.640324, 0.457492,
          0.872273,
             0.586974, 0.454029, 0.861943, 0.568448, 0.441994,
          0.825895,
             0.39336, 0.396855, 0.690417, 0.20754, 0.395551, 0.686462,
             0.255852, 0.392548, 0.677572, 0.17963, 0.350269, 0.550753,
             0.612022, 0.341512, 0.524435, 0.760695, 0.313441,
          0.440292,
             0.52727, 0.304016, 0.411343, 0.164743, 0.300216, 0.400556,
             0.123016, 0.293312, 0.379549, 0.431375, 0.279583, 0.33874,
             0.571648, 0.267421, 0.302245, 0.850239, 0.266698,
          0.299818,
             0.85685, 0.226072, 0.177329, 0.737677, 0.217928, 0.152775,
             0.650557, 0.192837, 0.0784445, 0.831587, 0.187349,
          0.0619587,
             0.854096, 0.174868, 0.024533, 0.602241







          share|improve this answer











          $endgroup$



          SeedRandom[5]
          d = RandomReal[1, 100, 3];


          You can use -.5 + 3 # - #2 & (or Function[x, y, -.5 + 3 x - y]) as the setting for MeshFunctions in ListPlot3D:



          Show[lp3d = ListPlot3D[d, MeshFunctions -> -.5 + 3 # - #2 &, 
          Mesh -> 0, MeshStyle -> Directive[Red, Thick], BoundaryStyle -> None],
          Graphics3D[Thick , Blue, Line[0, -.5, 1, 0.5, 1, 1],
          Opacity[.5, Yellow], EdgeForm @ None,
          InfinitePlane[0, -.5, 0, 0, -.5, 1, 0.5, 1, 1]]]


          enter image description here



          To extract the points on the red line:



          Cases[Normal @ lp3d, Line[x_] :> x, All][[1]]



          0.492655, 0.977959, 0.559503, 0.491386, 0.973947,
             0.484116, 0.477966, 0.933211, 0.303948, 0.476062, 0.92816,
             0.451244, 0.459746, 0.878862, 0.640324, 0.457492,
          0.872273,
             0.586974, 0.454029, 0.861943, 0.568448, 0.441994,
          0.825895,
             0.39336, 0.396855, 0.690417, 0.20754, 0.395551, 0.686462,
             0.255852, 0.392548, 0.677572, 0.17963, 0.350269, 0.550753,
             0.612022, 0.341512, 0.524435, 0.760695, 0.313441,
          0.440292,
             0.52727, 0.304016, 0.411343, 0.164743, 0.300216, 0.400556,
             0.123016, 0.293312, 0.379549, 0.431375, 0.279583, 0.33874,
             0.571648, 0.267421, 0.302245, 0.850239, 0.266698,
          0.299818,
             0.85685, 0.226072, 0.177329, 0.737677, 0.217928, 0.152775,
             0.650557, 0.192837, 0.0784445, 0.831587, 0.187349,
          0.0619587,
             0.854096, 0.174868, 0.024533, 0.602241








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 7 hours ago

























          answered 7 hours ago









          kglrkglr

          204k10 gold badges233 silver badges463 bronze badges




          204k10 gold badges233 silver badges463 bronze badges























              0












              $begingroup$

              You can use the interpolation that ListPlot uses, which you can then evaluate at any point on the line (within the domain of the interpolation):



              zFN = Interpolation[d, InterpolationOrder -> 1, 
              "ExtrapolationHandler" -> Indeterminate &, "WarningMessage" -> False];

              ClearAll[xyline, zSect];
              xyline[x_] = (1 - 2 x), 2 x.0, -.5, 0.5, 1;
              zSect[x_] := zFN @@ xyline[x];

              zSect[0.25] (* test a value *)
              (* 0.654833 *)

              Show[
              ListPlot3D[d],
              ParametricPlot3D[Append[xyline[x], zSect[x]], x, 0, 1]
              ]


              enter image description here






              share|improve this answer









              $endgroup$

















                0












                $begingroup$

                You can use the interpolation that ListPlot uses, which you can then evaluate at any point on the line (within the domain of the interpolation):



                zFN = Interpolation[d, InterpolationOrder -> 1, 
                "ExtrapolationHandler" -> Indeterminate &, "WarningMessage" -> False];

                ClearAll[xyline, zSect];
                xyline[x_] = (1 - 2 x), 2 x.0, -.5, 0.5, 1;
                zSect[x_] := zFN @@ xyline[x];

                zSect[0.25] (* test a value *)
                (* 0.654833 *)

                Show[
                ListPlot3D[d],
                ParametricPlot3D[Append[xyline[x], zSect[x]], x, 0, 1]
                ]


                enter image description here






                share|improve this answer









                $endgroup$















                  0












                  0








                  0





                  $begingroup$

                  You can use the interpolation that ListPlot uses, which you can then evaluate at any point on the line (within the domain of the interpolation):



                  zFN = Interpolation[d, InterpolationOrder -> 1, 
                  "ExtrapolationHandler" -> Indeterminate &, "WarningMessage" -> False];

                  ClearAll[xyline, zSect];
                  xyline[x_] = (1 - 2 x), 2 x.0, -.5, 0.5, 1;
                  zSect[x_] := zFN @@ xyline[x];

                  zSect[0.25] (* test a value *)
                  (* 0.654833 *)

                  Show[
                  ListPlot3D[d],
                  ParametricPlot3D[Append[xyline[x], zSect[x]], x, 0, 1]
                  ]


                  enter image description here






                  share|improve this answer









                  $endgroup$



                  You can use the interpolation that ListPlot uses, which you can then evaluate at any point on the line (within the domain of the interpolation):



                  zFN = Interpolation[d, InterpolationOrder -> 1, 
                  "ExtrapolationHandler" -> Indeterminate &, "WarningMessage" -> False];

                  ClearAll[xyline, zSect];
                  xyline[x_] = (1 - 2 x), 2 x.0, -.5, 0.5, 1;
                  zSect[x_] := zFN @@ xyline[x];

                  zSect[0.25] (* test a value *)
                  (* 0.654833 *)

                  Show[
                  ListPlot3D[d],
                  ParametricPlot3D[Append[xyline[x], zSect[x]], x, 0, 1]
                  ]


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 55 mins ago









                  Michael E2Michael E2

                  155k12 gold badges213 silver badges502 bronze badges




                  155k12 gold badges213 silver badges502 bronze badges



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Mathematica Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f201815%2fextracting-points-from-3d-plot-that-lie-along-an-arbitrarily-oriented-line%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                      Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                      199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單