# How to get a RegionIntersection output as a primitive instead of a BooleanRegion?

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}]]]


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.

• Solve[{x, y, z} ∈ line && {x, y, z} ∈ plane, {x, y, z}] Nov 6, 2023 at 14:00

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}]

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}].

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}]


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]


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