What I am looking for is something like the output of this code:
DiscretizeRegion[Line[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
MaxCellMeasure -> {"Length" -> 0.1}]
but I just want to have a list of the points on this line.
Thanks
What I am looking for is something like the output of this code:
DiscretizeRegion[Line[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
MaxCellMeasure -> {"Length" -> 0.1}]
but I just want to have a list of the points on this line.
Thanks
This is easily done with Subdivide[] and some deft use of dot products:
lineSubdivide[{p1_, p2_}, n_Integer?Positive] :=
With[{t = Subdivide[n]}, Transpose[{1 - t, t}] . {p1, p2}]
{Graphics[Point[lineSubdivide[{{0, 0}, {1, 1}}, 10]], Axes -> True],
Graphics3D[Point[lineSubdivide[{{0, 0, 0}, {1, 1, 1}}, 10]]]}

Subdivide support multiple coordinate.Subdivide[{0, 0, 0}, {1, 1, 1}, 10]
MeshPrimitives can get the coordinates. ( Here we do not use MeshCoordinates since it not always in order.)reg = DiscretizeRegion[Line[{p1, p2}],
MaxCellMeasure -> {"Length" -> 1/5}];
MeshPrimitives[reg, 1][[;; , 1]]