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!
Related
Here are three curve
All the curve contains so many spikes and noises. I'm interesting to see which curve has less chaos
One way is to use np.convolve to smooth the curve. Unfortunately, it lost so much information and defeat my original purposes.
I'm wondering if there different way of visualization ? (Not necessarily plotting the curve but use some math theorem to visualize the chaos in a different way)
Maybe Flatten out your plot by specifying the width, height for you plot.
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's manual suggests that there is no such implementation, if you know anything more let me know
N
This sounds like two questions, rather than one:
(1) How to intersect two planar cubic Bezier curves
(2) How to offset a planar cubic Bezier curve
I don't understand the statement that "there is no implementation". Maybe they just mean that there is no implementation in CGAL.
Both problems require numerical methods or approximation -- neither one has a closed-form solution.
But they are both well-known problems with many workable (approximate) solutions available. Searching for "intersect Bezier curves" or "offset Bezier curve" will return dozens of useful references and code samples.
If you want to solve these problems using CGAL ...
(1) Intersection. This is basically a root-finding problem, and CGAL has a bivariate root finder called AlgebraicKernel_d_2::Solve_2.
(2) Offsetting. Could perhaps be done using the Minkowski sum functions. Look at approximated_offset_2, for example. The result will be polygonal, but that might be good enough for your purposes. This is really a curve approximation problem, for which CGAL has no tools, as far as I can see.
For anyone interested:
"There is a CGAL implementation of an exact arrangement of Bezier curves ( http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Arrangement_on_surface_2/Chapter_main.html#Subsection_32.6.7 )" cheers Iddo Hanniel
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.
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.