How to produce equally distant samples in Matlab?

16 views (last 30 days)
I am interested to produce equally distant samples inside a closed n-dim space whereas each generated point has the same distance to its neighboring points. Is there any matlab function or method to do this?
Let's say we have a vector in 2D system with known coordination for the tip and tail of that vector. How to find equally distant samples over this vector? Let's assume we have a regular triangle shape and the coordination of the edges in the 3-dim Cartesian system is known. How to find equally distant samples in this shape? Last, what if the shape is not regular and has curvature arms (curves connecting the edges). Assume there are some known points (coordination) on the arms. How to find equally distant samples in this shape. For first figure:
p1=[1,3];
p2=[5,4];
for triangle shape:
p1=[1,3,0];
p2=[5,4,1];
p3=[-1,2,4];
for the last shape, there are just some known points on the arms (red curves).
  25 Comments
Walter Roberson
Walter Roberson on 4 Sep 2017
You cannot get a spatially-curved 3D figure from those points.
In your post https://www.mathworks.com/matlabcentral/answers/354968-how-to-produce-equally-distant-samples-in-matlab#comment_481591 you showed a diagram with a leaf, and that leaf appears to have a shadow. Are leaf and shadow images available? If so then it might be possible to deduce some 3D information (not easily though.)
Jamais avenir
Jamais avenir on 4 Sep 2017
Edited: Jamais avenir on 4 Sep 2017
@Walter, Now I am thinking on the simplified model where the leaf lies on a plane. As an example I've generated some points which indicate the boundary of a namely leaf-shape and they stay on a plane. I am curious to see how one can generate evenly spaced samples inside this boundary perhaps with your polyfitn. For the realistic model, I will ask for more information about coordinates of some points around the boundary and inside the leaf in order to simulate and visualize it on a computer first. Additionally, that was an example, we don't have the shadow.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 2 Sep 2017
I don't see how having curved "arms" makes any difference if you're just interested in finding the point in the middle between three specified points.
Anyway, you can write those points to an image and use bwdist() to compute the Euclidean Distance Transform. You may need to use poly2mask() if you have a solid shape with "arms".
Attach input data and desired result if you want more help.
  3 Comments
Image Analyst
Image Analyst on 3 Sep 2017
In your diagram, a point at the center of the hexagon is equidistant from only 6 other points and has different distances to all the other points.
Assuming that's what you want, you can generate such a hexagonal grid by simply making two simple rectangular grids and combining them, with one offset from the other by half a box.
Jamais avenir
Jamais avenir on 3 Sep 2017
@Image Analyst, Yes that's what I want. Would you give me some hint on how to do this on matlab please!
Generate such a hexagonal grid by simply making two simple rectangular grids and combining them, with one offset from the other by half a box.

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!