1
$\begingroup$

I have a polygon object that I wish to discretize.

e.g.

points0 = {{0, 0}, {1, 2}, {1, 0}, {0, 0}}
DiscretizeRegion[Line[points0]]

My goal is to increase the number of points between the edges using internal Mathematica functions. I have tried using Polygon, BoundaryDiscretize reigion and other functions but can't seem to get just the edge meshed. Any help would be greatly appreciated.

$\endgroup$
3
  • 6
    $\begingroup$ something like DiscretizeRegion[Line[points0], MaxCellMeasure -> {"Length" -> .1}]? $\endgroup$ Commented Mar 9, 2021 at 10:00
  • $\begingroup$ @kglr This is exactly what I was looking for! Many thanks. Do you want to do this as an answer? $\endgroup$ Commented Mar 9, 2021 at 13:10
  • $\begingroup$ Dunlop, posted the comment as an answer. $\endgroup$ Commented Mar 10, 2021 at 9:28

2 Answers 2

2
$\begingroup$

You can specify the maximum cell measures using the option MaxCellMeasure:

enter image description here

DiscretizeRegion[Line[points0], MaxCellMeasure -> {"Length" -> .1}] (* or *)

DiscretizeRegion[Line[points0], MaxCellMeasure -> {1 -> .1}]    

enter image description here

Use MaxCellMeasure -> {"Length" -> .5} to get

enter image description here

$\endgroup$
2
$\begingroup$

Given points0 we want to insert points so that the original interval between two point is split into n intervals:

n = 2;
points0 = {{0, 0}, {1, 2}, {1, 0}, {0, 0}};
tmp = Table[#[[1]] + i (#[[2]] - #[[1]])/n, {i, 0, n - 1}] & /@ 
  Partition[points0, 2, 1]
newpts=Append[Flatten[tmp, 1], points0[[-1]]]

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.