3
$\begingroup$

I've computed the intersection of a plane with some lines. It looks OK until I try to make a 3D graph from intersec_lines.

alpha = Pi/5;
r1 = 5;
r2 = 2;
h = 3;
n = 20;
plane = InfinitePlane[{{0, 0, 0}, {Cos[alpha], 0, Sin[alpha]}, {0, 1, 0}}];
lines = 
  Table[
    InfiniteLine[
      {r1*Cos[2*Pi*x/n], r1*Sin[2*Pi*x/n], 0}, 
      {r2*Cos[2*Pi*x/n], r2*Sin[2*Pi*x/n], h}], 
   {x, n}];
intersec_points = NSolve[{x, y, z} ∈ plane && {x, y, z} ∈ #]& /@ lines

Does anyone know how to do it? It seem it should be pretty basic, but I'm just starting to use Mathematica.

$\endgroup$
2
  • 2
    $\begingroup$ Do not use _ in variable names, since _ has a special meaning in Mathematica. $\endgroup$ Sep 29, 2018 at 14:06
  • $\begingroup$ To make it even clearer: Your code works except the variable named in not allowed because it has "_" in it. Then you have to write {x,y,z} /. Flatten[intersecPoints, 1] to get a list of points. $\endgroup$
    – C. E.
    Sep 29, 2018 at 16:17

1 Answer 1

6
$\begingroup$

Using RegionIntersection[] is the most straightforward route for finding the intersection points:

With[{α = π/5, r1 = 5, r2 = 2, h = 3, n = 20},
     plane = InfinitePlane[{{0, 0, 0}, {Cos[α], 0, Sin[α]}, {0, 1, 0}}];
     lines = Table[InfiniteLine[{r1 Cos[2 π x/n], r1 Sin[2 π x/n], 0},
                                {r2 Cos[2 π x/n], r2 Sin[2 π x/n], h}], {x, n}];]

pts = RegionIntersection[plane, #] & /@ lines;

Graphics3D[{plane, lines, Sphere[#, 1/4] & @@@ pts}, Axes -> True, PlotRange -> 10]

intersection points of a cone and a plane

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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