General Algorithmic Question

Suppose we have some mesh (see illustration of an image from CorelDraw that uses the same technique in the Mesh fill tool.

alt text http://www.sonic.net/mnitepub/pccafe/reviews/coreldraw9/meshfill.jpg

Obviously, this type of grid is represented by many points, and between them, lines are actually determined using this set of points (possibly somehow interpolated). This tool also has buttons to increase the resolution of the grid.

My question is: how are such things calculated? Suppose I have a certain set of points that actually represent a grid (for a simple case, even suppose that the points on the “border” are static and cannot move). And I want to increase the resolution of the cell, for example, 4 times (so the number of grid points actually becomes 4 * initial_points_count ).

How do I calculate the locations of new points if the only data I have is that the original matrix of points?

The fastest (even approximated) method will suit me, but I don’t know where to look or how to develop such an algorithm.

Thanks.

+7
algorithm resolution mesh
source share
5 answers

I would like to start by adding rehabilitation points to all the interpolation lines (the curves in the figure are most likely some kind of Bezier curves , so I would interpolate them as such, or use the biliniear interpolation proposed by Mau) and placing new points halfway between the old ones. giving me 3 times permission. Then I will interpolate between these new points (in both cases, if accuracy is key) and place the new point at the intersection (or halfway). See "Illustration" below.

 Initial state => Interpolate => Place points => Interpolate => Final state xx x-------xxxxxxxxxx | | | | | xx x---+---xxxx | | | xx x-------xxxxxxxxxx 
+2
source share

Comments on existing answers:

It seems to me that Mau and the abusive answer describe a solution to the problem of approximating a known shape using a polygonal mesh (and you don't know, t have a known shape).

The algorithm that Dave mentions smooths out any form, but not necessarily in the intended way.

If you look at the answer, you will see that the new points come from linear interpolation between the points, and if that is good enough for you, all solutions are comparable (except for Dave's).

Such an increase in the density of the mesh will not make the resulting mesh look “better”, which is more like the original shape. If this is not good enough, you first need to decide what the actual shape / shape you are trying to represent with the grid (if you could expand your example, this might be a little more obvious: this tool only creates circular meshes or it can take any shape and "fill the grid"?).

In addition, you should note that you are not working with a polygonal grid, but with a grid of curves (possibly bezier ), which is another reason why some of the answers will not be directly applied to your problem.

EDIT: After taking a closer look at how Corel does this and assuming that you really know the curves of more than just dots (!):

  • You start with a set of curves, and it seems to me that you have horizontal and vertical curves starting with
  • If you want to increase the resolution (for example, horizontal resolution), you can take two consecutive vertical curves and divide each segment of horizontal curves passing through the mid point, thereby creating a set of points that define the new curve; you can also interpolate the angle at which the curve passes through the point

alt text http://img706.imageshack.us/img706/5693/path5818.png

The above (hand-drawn) image shows an attempt to illustrate a) adding a new curve (red) that you create in this way. b) adding a linearly interpolated polyline (blue), which is more suitable for approaching a polygonal grid (so you can judge if this is acceptable for you)

Note Depending on the algorithm for which you are preparing the grid, you may or may not have any advantages when considering grid lines as curves (the difference between the red and blue solutions may be insignificant for a particular algorithm and important for others). If the algorithm just expects points, then you should also look at how to approximate Bezier curves with points (reading through this might help, t need pixel precision).

For maximum accuracy / best results, you must first increase the density of the curves and bring them closer to the lines.

+4
source share

Did you watch subdivision ? Should work to refine such grids.

+2
source share

What you are looking for is a sleek mesh algorithm. Unfortunately, I don't have any resources, so I can suggest google for "smoothing the grid". This is a huge field.

EDIT

Here is a good, short, roundup of several methods / algorithms for achieving a smoothing grid: http://www.mpi-inf.mpg.de/~ag4-gm/handouts/06gm_surf3.pdf

+2
source share

Sounds like work for bilinear interpolation (where the coordinate system is on the surface of a sphere).

+1
source share

All Articles