4
$\begingroup$

How can I define a region that is bounded by a set of parametric curves?

E.g. three parametric curves - which are cubic Bezier curves - define the boundary of a shape:

cubicbez[a_, b_, c_, d_, t_] := (1 - t)^3*a + 3*(1 - t)^2*t*b + 3*(1 - t)*t^2*c + t^3*d bezierRegion[{a_, b_, c_, d_}] := ParametricRegion[cubicbez[a, b, c, d, t], {{t, 0, 1}}] regions = {bezierRegion[{{5, 5}, {10, 13}, {18, 4}, {20, 30}}], bezierRegion[{{20, 30}, {18, 40}, {17, 40}, {15, 35}}], bezierRegion[{{15, 35}, {25, 25}, {5, 20}, {5, 5}}]}; Show[Region /@ regions, Frame -> True] 

Shape defined by a chain of parametric curves

Is there a way to get the inside of that shape as a Mathematica region?

$\endgroup$

2 Answers 2

9
$\begingroup$

Edit

  • Another way is just use
Show[Region /@ regions, Frame -> False] // BoundaryDiscretizeGraphics 
BezierCurve[{{5, 5}, {10, 13}, {18, 4}, {20, 30}, {18, 40}, {17, 40}, {15, 35}, {25, 25}, {5, 20}, {5, 5}}] // BoundaryDiscretizeGraphics 
fig = Graphics@ FilledCurve@ BezierCurve[{{5, 5}, {10, 13}, {18, 4}, {20, 30}, {18, 40}, {17, 40}, {15, 35}, {25, 25}, {5, 20}, {5, 5}}]; reg = BoundaryDiscretizeGraphics[fig] 

enter image description here

$\endgroup$
0
3
$\begingroup$

An alternative approach: You can use the coordinate data to define BezierFunctions and use them to construct a polygon which can be used as is as a region or discretized using BoundaryDiscretizeRegion:

bzfuncs = {BezierFunction[{{5, 5}, {10, 13}, {18, 4}, {20, 30}}], BezierFunction[{{20, 30}, {18, 40}, {17, 40}, {15, 35}}], BezierFunction[{{15, 35}, {25, 25}, {5, 20}, {5, 5}}]}; poly = Polygon[Join @@ (Map[#]@Subdivide[100] & /@ bzfuncs)]; RegionQ @ poly 
True 
Graphics[{EdgeForm[Gray], FaceForm[LightBlue], poly}] 

enter image description here

BoundaryDiscretizeRegion @ poly 

enter image description here

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.