Regions for numerically defined Toroidal surfaces
Here are some modifications to ParametricPlot
:
Method -> {"BoundaryOffset" -> False}
Mesh -> None
PlotPoints -> {40, 20}
MaxRecursion -> 1
PlotRange -> All
The first one is important, since it allows the pairs of boundaries, u == 0
, u == 1
and v == 0
, v == 1
, to match up. The Mesh
option is important because it prevents the polygons being broken for the sake of a mesh line. The next two needed tweaking. Some settings resulted in meshes that had problems. Sometimes the problems were fixed with RepairMesh
and sometimes not. The best chance of generating a defect-free mesh is MaxRecursion -> 0
, since the recursive subdivision is not guaranteed to match up on opposite edges; usually RepairMesh
fixes this problem. PlotRange -> All
is safer than Automatic
; I sometimes got small holes from the surface being clipped.
surfacefunc =
BSplineFunction[data, SplineClosed -> {True, True},
SplineDegree -> 3];
plot = ParametricPlot3D[surfacefunc[u, v], {u, 0, 1}, {v, 0, 1},
PlotRange -> All,
PlotPoints -> {40, 20}, (* to get initial grid of approx. squares *)
MaxRecursion -> 1, (* works with 0, 1; 2 requires RepairMesh *)
Method -> {"BoundaryOffset" -> False},
Mesh -> None];
reg = DiscretizeGraphics[plot, PlotRange -> Automatic];
FindMeshDefects[reg]
surfacefunc =
BSplineFunction[data, SplineClosed -> {True, True},
SplineDegree -> 3];
reg = ParametricPlot3D[surfacefunc[u, v], {u, 0, 1}, {v, 0, 1},
Boxed -> False, Axes -> False];
DiscretizeGraphics[reg]
The Indexed
approach produces:
reg = ParametricRegion[
{
Indexed[surfacefunc[θ, φ], 1],
Indexed[surfacefunc[θ, φ], 2],
Indexed[surfacefunc[θ, φ], 3]
},
{{θ, 0, 1}, {φ, 0, 1}}
];
mesh = DiscretizeRegion[reg, PerformanceGoal->"Quality"];
FindMeshDefects[mesh]