3D Regions by Jared Antrobus

Parametric Region Plot 3D

parametricRegionPlot3D[{x_,y_,z_},{var1_Symbol,var1range__},{var2_Symbol,var2range__},{var3_Symbol,var3range__},range_:{{-10,10},{-10,10},{-10,10}}]:=
Module[
{
var1min=List[var1range][[1]],
var1max=List[var1range][[-1]],
var2min=List[var2range][[1]],
var2max=List[var2range][[-1]],
var3min=List[var3range][[1]],
var3max=List[var3range][[-1]],
},
Show[{

(* regions and surfaces *)
(* if var2 and var3 are ranging *)
If[
var2min≠var2max&&var3min≠var3max,
ParametricPlot3D[
{{x,y,z}/.{var1->var1min},
{x,y,z}/.{var1->var1max}},
{var2,var2min,var2max},{var3,var3min,var3max},
BoundaryStyle->Thick,Mesh->None,Boxed->False
],
{}],
(* if var1 and var3 are ranging *)
If[
var1min≠var1max&&var3min≠var3max,
ParametricPlot3D[
{{x,y,z}/.{var2->var2min},
{x,y,z}/.{var2->var2max}},
{var1,var1min,var1max},{var3,var3min,var3max},
BoundaryStyle->Thick,Mesh->None,Boxed->False
],
{}],
(* if var1 and var2 are ranging *)
If[
var1min≠var1max&&var2min≠var2max,
ParametricPlot3D[
{{x,y,z}/.{var3->var3min},
{x,y,z}/.{var3->var3max}},
{var1,var1min,var1max},{var2,var2min,var2max},
BoundaryStyle->Thick,Mesh->None,Boxed->False
],
{}],

(* space curves *)
(* if var1 is ranging, with var2 and var3 as constants *)
If[
var1min≠var1max&&var2min==var2max&&var3min==var3max,
ParametricPlot3D[
{x,y,z}/.{var2->var2min,var3->var3min},
{var1,var1min,var1max},
Mesh->None,Boxed->False
],
{}],
(* if var2 is ranging, with var1 and var3 as constants *)
If[
var2min≠var2max&&var1min==var1max&&var3min==var3max,
ParametricPlot3D[
{x,y,z}/.{var1->var1min,var3->var3min},
{var2,var2min,var2max},
Mesh->None,Boxed->False
],
{}],
(* if var3 is ranging, with var1 and var2 as constants *)
If[
var3min≠var3max&&var1min==var1max&&var2min==var2max,
ParametricPlot3D[
{x,y,z}/.{var1->var1min,var2->var2min},
{var3,var3min,var3max},
Mesh->None,Boxed->False
],
{}],

(* points *)
(* if var1, var2, and var3 are all constants *)
If[
var1min==var1max&&var2min==var2max&&var3min==var3max,
Graphics3D[
Point[{x,y,z}/.{var1->var1min,var2->var2min,var3->var3min}],
Boxed->False
],
{}],

(* plot the origin *)
Graphics3D[Point[{0,0,0}],Boxed->False]

},
(* Graphics Options *)
PlotRange->range,
ImageSize->{450,450},
Axes->True,
AxesOrigin->{0,0,0}
]
]

Rectangular Regions

Manipulate[
Column[{
parametricRegionPlot3D[{x,y,z},{x,xmin,xmax},{y,ymin,ymax},{z,zmin,zmax}],
Row[{"x: [" ,xmin, ",",xmax,"]"}],Row[{"y: [" , ymin, ",",ymax,"]"}],Row[{"z: [" , zmin, ",",zmax,"]"}],
}],
{{xmin,0},-10,10,.1},{{xmax ,5},-10,10,.1},
{{ymin,0},-10,10,.1},{{ymax,5},-10,10,.1},
{{zmin,0},-10,10,.1},{{zmax,5},-10,10,.1},
ControlPlacement->Left,ControllerLinking->False,SaveDefinitions->True
]

Cylindrical Regions

Manipulate[
Column[{
parametricRegionPlot3D[{r Cos[θ],r Sin[θ],z},{r,rmin,rmax},{θ,θmin,θmax},{z,zmin,zmax}],
Row[{"r: [" , rmin, ",",rmax,"]"}],Row[{"θ: [" , θmin, ",",θmax,"]"}],Row[{"z: [" , zmin, ",",zmax,"]"}],
}],
{{rmin,5},0,10,.1},{{rmax ,10},0,10,.1},
{{θmin,0},0,2π,(π/32)},{{θmax,((5π)/4)},0,2π,(π/32)},
{{zmin,0},-10,10,.1},{{zmax,5},-10,10,.1},
ControlPlacement->Left,ControllerLinking->False,SaveDefinitions->True
]

Spherical Regions

Manipulate[
Column[{
parametricRegionPlot3D[{ρ Sin[ϕ]Cos[θ],ρ Sin[ϕ ]Sin[θ],ρ Cos[ϕ]},{ρ,ρmin,ρmax},{θ,θmin,θmax},{ϕ,ϕmin,ϕmax}],
Row[{"ρ: [" , ρmin, ",",ρmax,"]"}],Row[{"θ: [" , θmin, ",",θmax,"]"}],Row[{"ϕ: [" , ϕmin, ",",ϕmax,"]"}],
}],
{{ρmin,5},0,10,.1},{{ρmax ,10},0,10,.1},
{{θmin,0},0,2π,(π/32)},{{θmax,((5π)/4)},0,2π,(π/32)},
{{ϕmin,(π/4)},0,π,(π/32)},{{ϕmax,((3π)/4)},0,π,(π/32)},
ControlPlacement->Left,ControllerLinking->False,SaveDefinitions->True
]

Spherical Regions 2

Manipulate[
Column[{
Show[
{
(* Spherical Sectors (ρ as a constant) *)
If[θmin≠θmax&&ϕmin≠ϕmax,
ParametricPlot3D[
{{ρmin Sin[ϕ]Cos[θ],ρmin Sin[ϕ]Sin[θ],ρmin Cos[ϕ]},
{ρmax Sin[ϕ]Cos[θ],ρmax Sin[ϕ]Sin[θ],ρmax Cos[ϕ]}},
{θ,θmin,θmax},{ϕ,ϕmin,ϕmax},
BoundaryStyle->Thick,Mesh->None,Boxed->False
],
{}],
(* Cone Frustums (ϕ as a constant) *)
If[ρmin≠ρmax&&θmin≠θmax,
ParametricPlot3D[
{{ρ Sin[ϕmin]Cos[θ],ρ Sin[ϕmin]Sin[θ],ρ Cos[ϕmin]},
{ρ Sin[ϕmax]Cos[θ],ρ Sin[ϕmax]Sin[θ],ρ Cos[ϕmax]}},
{ρ,ρmin,ρmax},{θ,θmin,θmax},
BoundaryStyle->Thick,Mesh->None,Boxed->False
],
{}],
(* Plane Slices (θ as a constant) *)
If[ρmin≠ρmax&&ϕmin≠ϕmax,
ParametricPlot3D[
{{ρ Sin[ϕ]Cos[θmin],ρ  Sin[ϕ]Sin[θmin],ρ Cos[ϕ]},
{ρ Sin[ϕ]Cos[θmax],ρ  Sin[ϕ]Sin[θmax],ρ Cos[ϕ]}},
{ρ ,ρmin,ρmax},{ϕ,ϕmin,ϕmax},
BoundaryStyle->Thick,Mesh->None,Boxed->False
],
{}],
(* Origin Point *)
Graphics3D[Point[{0,0,0}],Boxed->False]
},
(* Graphics Options *)
PlotRange->{{-10,10},{-10,10},{-10,10}},
ImageSize->{450,450},
Axes->None
],
(* Display current values of ρ, θ, and ϕ *)
Row[{"ρ: [" , ρmin, ",",ρmax,"]"}],Row[{"θ: [" , θmin, ",",θmax,"]"}],Row[{"ϕ: [" , ϕmin, ",",ϕmax,"]"}],
}],
(* Ranges *)
{{ρmin,5},0,10},{{ρmax ,10},0,10},
{{θmin,0},0,2π},{{θmax,((5π)/4)},0,2π},
{{ϕmin,(π/4)},0,π},{{ϕmax,((3π)/4)},0,π},
ControlPlacement->Right
]