3
$\begingroup$
line = ParametricRegion[{2 + 3 t, -1 + t, 3 - 2 t}, {t}];
plane = ImplicitRegion[2 x + 3 y - z == 9, {x, y, z}];

r3 = RegionIntersection[line, plane]

BooleanRegion[#1 && #2 &, {ParametricRegion[{2 + 3 t, -1 + t, 3 - 2 t}, {t}], ImplicitRegion[2 x + 3 y - z == 9, {x, y, z}]}]

Show[Region[plane], Region[Style[line, Red]], 
 Region[Style[r3, {AbsolutePointSize[8], Green}]]]

enter image description here

Question1a: (intersects in a point)

How do I convert the BooleanRegion output to e.g., Line or Point primitives? In this particular case, it is a point shown in Green.

Question1b: (line in the plane)

This is the case, where the line is in the same plane.

line = ParametricRegion[{1/2 - 1/10 t, -93/10 + 7/10 t, -359/10 + 
     19/10 t}, {t}];
plane = ImplicitRegion[2 x + 3 y - z == 9, {x, y, z}];
r4 = RegionIntersection[line, plane]
Show[Region[plane], Region[Style[line, Red]]]

I am using v12.2.0 on Win7-x64. Thanks for your help.

$\endgroup$
1
  • 1
    $\begingroup$ Solve[{x, y, z} ∈ line && {x, y, z} ∈ plane, {x, y, z}] $\endgroup$
    – cvgmt
    Nov 6, 2023 at 14:00

2 Answers 2

5
$\begingroup$

Mathematica cannot automatic recognize the structure of the line and plane. It is recommended to use the special form to tell Mathematica such structure.

Clear[line, plane, intersection];
line = InfiniteLine[{1/2, -93/10, -359/10}, {-1/10, 7/10, 19/10}];
plane = Hyperplane[{2, 3, -1}, 9];
intersection = RegionIntersection[line, plane]
Graphics3D[{AbsoluteThickness[3], {Yellow, plane}, {Green, line}, 
  Opacity[.5], Red, AbsoluteThickness[6], intersection}, 
 Lighting -> {{"Ambient", White}}, PlotRange -> 6]

InfiniteLine[{1/2, -(93/10), -(359/10)}, {-(1/10), 7/10, 19/10}]

enter image description here

Clear[line, plane, intersection];
line = InfiniteLine[{2, -1, 3}, {3, 1, -2}];
plane = Hyperplane[{2, 3, -1}, 9];
intersection = RegionIntersection[line, plane]
Graphics3D[{AbsoluteThickness[3], {Yellow, plane}, {Green, line}, 
  Opacity[.5], Red, AbsolutePointSize[10], intersection}, 
 Lighting -> {{"Ambient", White}}, PlotRange -> 6]

Point[{5, 0, 1}].

enter image description here

$\endgroup$
3
$\begingroup$

Using DiscretizeRegion & MeshPrimitives :

Question 1a

line = ParametricRegion[{2 + 3 t, -1 + t, 3 - 2 t}, {t}];
plane = ImplicitRegion[2 x + 3 y - z == 9, {x, y, z}];
r3 = RegionIntersection[line, plane];

primitives = DiscretizeRegion@r3 // MeshPrimitives

{Point[{5., 1.18872*10^-16, 1.}]}

Graphics3D[{Green, Last@primitives}, Axes -> True, ViewPoint -> Front, Ticks -> {{0, 5, 10}, None}]

enter image description here

Question 1b

The degenerate case (line is in the plane) can be detected using RegionWithin

line = ParametricRegion[{1/2 - 1/10 t, -93/10 + 7/10 t, -359/10 + 
     19/10 t}, {t}];
plane = ImplicitRegion[2 x + 3 y - z == 9, {x, y, z}];
r4 = RegionIntersection[line, plane];

RegionWithin[plane, line]
(*True*)

This reduces the intersection to the line, therefore:

primitives = line // DiscretizeRegion // MeshPrimitives

(*{{Point[{-8.9998, -4.6666, 10.3332}], Point[{-8.22499, -4.40833, 9.81666}]...}
  ,{Line[{{-8.9998, -4.6666, 10.3332}, {-8.22499, -4.40833, 9.81666}}]...}}
*)

MeshPrimitives returns the primitives for both dimensions 0 and 1

Graphics3D[{Green, Last@primitives}, Axes -> True]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks for your answer. Please see the updated question. The MeshPrimitives[...,0] requires prior knowledge of the intersection region. Can it be generalized? $\endgroup$
    – Syed
    Nov 6, 2023 at 14:16

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.