Cubic Bezier from sample points - bezier

The sample points is taken from a flying machine in a fix sample rate (e,g 1s=25 frame), it contains the x,y,z position.
The requirement is to import the point lists and edit the curve, then export it to a new point lists.
I want to use the Cubic Bezier curve to display the points, the problem is :
The flying path is arbitrary, can it always be drawn in Bezier curve?
How to confirm the vertex and control points?
The reason of vertex and control point is for editing, i want to drag the control point to modify the curve.
Am new for this field, any suggestion or sample code is appreciated. :)

Cubic Bezier spline won't fit to an arbitrary digitized curve. If Cubic Bezier spline approximate your curve with unacceptable square error, there are two options:
Split original curve into segments (for example, where curve bends) and then fit segments with Cubic Bezier splines. There is a description of an algorithm for automatically fitting digitized curves
Use higher order Bezier splines than cubic, which can fit any continuous smooth curve.
This will result in iterative process to find Bezier spline of minimum order fitting the curve with an acceptable error.

Related

How to keep Gmsh mesh in the bounding curves?

i am quite a beginner in Gmsh and am trying to create a mesh for hydrodynamic simulation from coastlines. I used splines for the complex coastline for simplicity, but the produced mesh crossed over the coastlines. What should i do to make the mesh not cross over the bounding curves?
Image for reference
Your mesh is simply to coarse in the moment. The points of each Triangle in the mesh lie on the real geometry/coastline but the edges are linearly connected and do not care about the geometry.
In order to refine the mesh you might try to press Mesh->Refine by Splitting a couple of times and see split the few current cells. The mesh should get finer and should not violate the geometry boarder by as much as right now.
BUT by this you'll only make the "issue" less obvious to see. On a smaller scale you will always see mesh cells that are partly "outside" the geometry borders. You cannot prevent this with concave meshes like the one you have here. If you have s.th. convex like a circle all elements will strictly lie inside the geometry border.
So as a first step, make a finer mesh until you are satisfied with the match between geometry and mesh.

Constrained Delaunay Triangulation with curve boundary

Does CGAL only support Constrained Delaunay Triangulation (CDT) for Planar Straight Line Graph (PSLG) now?
What about a curve boundary, like a circle or ellipse? I tried to discretize the curve boundary manually, but the element quality is not satisfactory.
Thanks

Intersection between Bezier curve and line. How can I insure that this intersection is smooth?

I am trying to use Bezier curves to plot a path.
After conducting some research, I decided to use Bezier curves.
I have both the starting point and endpoint as a given. However, the endpoint is a corner point of a line. Thus, I am technically connecting a given starting point to a line that intersects it at the given endpoint.
The problem I am facing is that the intersection between the Bezier curve and the line is not smooth.
Note: I am using a cubic polynomial.
A bezier curve is tangent to the line between the control points and endpoints. In other words, if you put your control point on the extension of the horizontal line, the curve will be tangent to it at the endpoint and you'll have a smooth result.
Tangent:
Not tangent:

How to build a smart bezier curve?

Demo Image : http://i.picpar.com/bzH.png
I want to build a smart bezier curve like this. There are 100 targets (grid) in the map. I know the source point (Rocket), and the target point (Grid). How to calculate two control points to build a beautiful bezier curve which can not across the blue map?
Find curve bounding box and then check if it is contained in blue map rectangle. If it will be outside move control points respectively.
Assuming that you are using cubic Bezier curve (4 control points) for first try You might set some default coordinates of curve control points:
P1(p0.x-10,p0.y+10)
P2(p3.x-10,p3.y+10)
I do not know what language/libraries You are using but it might have Rectangle.Contains(Bezier.BoundingBox) function which might make things easier.

How To Find The Best Control Point For Quadratic Bezier Curve?

I want to draw an airfoil with knowing it's coordinates.i decide to use quadratic bezier curve so with first and end points of bezier equation, how to find the best control point for this quadratic bezier curve that pass through a set of points? (coordinates of airfoils)
The question you're asking is very similar to this one: How can I fit a Bézier curve to a set of data?