How to generate isolines (contour lines) at specific values from irregular data? - lines

I have an array of sample points with their (X, Y, Z) coordinates. I use Delaunay Triangulation to generate an irregular network from them and then I use linear interpolation to plot contour lines at fixed values (e.g. 90, 95, 100, 105). The problem is that I need smooth contour lines to be generated with another algorithm. I've searched for some time now and found out that I need to use something like Kriging but I'm not that good at math to implement the algorithm from pure mathematical relations. Also I can't seem to find an implementation or explanation of the algorithm anywhere. Can anyone help me find one? Also, am I right with the chosen algorithm? Is there another one that can be easier to implement? Note that I don't care about precision.
https://dl.dropbox.com/u/15926260/ex.png
P.S. I've done a plot in Surfer showing the results that I'm looking for. On the right side is what I have done using triangulation and linear interpolation and on the left side is what I need to plot using a different algorithm (Kriging was used in Surfer).
Sorry for the spelling mistakes but I'm not a native language speaker.
Thank you!

You can try a regular (weighted) delaunay triangulation. In weighted delaunay triangulation triangle areas are more equal. IMO the kriging algorithm seems also to produce more equally contours. Weighted delaunay triangulation is also used to make smoother meshes.

Related

Scale Bezier Curve

I need to adjust the length of a (cubic) Bezier curve to match that of another one, without disturbing its overall shape. This involves, I guess, proportionately scaling it recursively until the length is of the right magnitude (or is there any better approach?).
I have got the function that calculates the length. For scaling, I am stuck at calculating the coordinates of the new control points. There is this question that seems to have the answer but I am unable to figure out to what the variables a, b etc. refer in the answer. Also, I need to write a function from scratch, without having recourse to any API library (except python math).
Any help is appreciated.
Denoting the length of your curve by L and the desired length D, it seems to me that you just need to scale your curve (D/L)-times. Thanks to affine invariance, it should be enough to scale all your control points. That is, multiply each coordinate of each of your control points by D/L.
Or did I miss something?

CGAL 3D surface mesh generation for unbounded implicit surfaces

This is again a question about the CGAL 3D surface mesher.
http://doc.cgal.org/latest/Surface_mesher/index.html#Chapter_3D_Surface_Mesh_Generation
With the definition
Surface_3 surface(sphere_function, // pointer to function
Sphere_3(CGAL::ORIGIN, 64.0)); // bounding sphere
(as given too in the example code) I define an implicit surface given by 'sphere function' and a Sphere_3 of radius 8.
The difference is now, that the zeros of 'sphere function' are (contrary to its now misleading name) no longer bounded and inside Sphere_3. Instead 'sphere_function' represents an unbounded surface (think of x^2 + y^2 - z^2 - 1 = 0) and my intention is to triangularize its part that is in the Sphere_3.
In my examples up to now this worked quite well, if only for some annoying problem, I do not know how to overcome: The boundaries, where the implicit surface meets the Sphere, are very "rough" or "jagged" in a more than acceptable amount.
I already tried the 'Manifold_with_boundary_tag()', but it gave no improvements.
One road to improve the output that I am contemplating, is converting the triangulated mesh (a C2t3) into a Polyhedron_3 and this in a Nef_polyhedron and intersect that with a Nef_polyhedron well approximating a slightly smaller Sphere. But this seems a bit like shooting with cannons for sparrows, nevertheless I have currently no better idea and googling gave me also no hint. So my question: What to do about this problem? Can it be done with CGAL (and moderate programming effort) or is it necessary or better to use another system?
(Just for explanation for what I need this: I try to develop a program that constructs 3D-printable models of algebraic surfaces and having a smooth and also in the boundaries smooth triangulation is my last step that is missing before I can hand the surface over to OpenSCAD to generate a solid body of constant thickness).
The only solution I see is to use the 3D Mesh Generation with sharp feature preservation and no criteria on the cells. You will have to provide the intersection of the bounding sphere with the surface yourself.
There is one example with two intersecting spheres in the user manual.

How to get one non-manifod mesh with adaptive point distribution

all
I try to obtain one triangle mesh from one point cloud. The mesh is expected to be manifold, the triangles are well shaped or equilateral and the distribution of the points are adaptive in terms of the curvature.
There are valuable information provided on this website.
robust algorithm for surface reconstruction from 3D point cloud?
Mesh generation from points with x, y and z coordinates
I try Poisson reconstruction algorithm, but the triangles are not well shaped.
So I need to improve the quality of the triangles. I learn that centroidal voronoi tessellation(CVT) can achieve that, but I don't know whether the operation will introduce non-manifold vertices and self-intersection. I hope to get some information about it from you.
The mesh from the following post looks pretty good.
How to fill polygon with points regularly?
Delaunay refinement algorithm is used. Can delaunay refinement algorithm apply to triangle mesh directly? Do I first need to delaunay triangulation of the point cloud of the mesh, and then use the information from delaunay triangulation to perform delaunay refinement?
Thanks.
Regards
Jogging
I created the image in the mentioned post: You can insert all points into a Delaunay triangulation and then create a Zone object (area) consisting of these triangles. Then you call refine(pZone,...) to get a quality mesh. Other options are to create the Zone from constraint edges or as the result of a boolean operation. However, this library is made for 2D and 2.5D. The 3D version will not be released before 2014.
Do you know the BallPivoting approach?

Need a suggestion on curve processing (curve-fitting, interpolation)

I have a set of points which form some curve, see picture. This curve consists of straight and curved sections and I do not know exactly where they start or end. In the presented picture I know at least five pieces: two straight sections, one section with a constant radius, two other types of curves. I want to be able to recognise those sections, to separate them from each other and to work with them as with separate curves.
Update.
In my opinion splines would not work in the way I want, and not surely Besier. I was thinking about Non-linear Least Squares but was not sure if it suits this case. If I am able to separate the parts, then I can use Linear Least Squares for straights and some non-linear for other parts. Otherwise, I need some universal method which will work for all types of curves: 1, 2 and 3 power.
Please share your thoughts.
Thank you.
For a bent tube I would suggest multidimensional spline fitting. Your tube does not look like a composition of of straight and curved sections, but curves smoothly all the way.
http://en.wikipedia.org/wiki/Spline_interpolation
This is the starting point if you want to read further.
Taking a guess I suppose you are not experienced with splines, so if you could put out the dataset in table form me or some other reader could interpolate the given data with a 3D spline curve.

how to compare the similarity of two 2D bezier curves

I am not familiar with bezier curves, but I need to compare two bezier curves for my project. A quick idea come up in my mind is to sample the two curves and then compare the sampled polylines using something like laplacian coordinates. This way I am comparing the points on the curve, which makes sense. But then I need to worry about the sampling rate. Another idea is to compare the control points of the bezier curves, however I am not sure if it makes sense to do so. Does anyone have experience on doing comparison between bezier curves?
Thanks in advance!