1
$\begingroup$

The parameters of the rational Bezier curve have been converted into a discrete representation of points using this formula.

Where P is the control point, w is weight.

I plan to extrude this 2d representation into 3d. I have a discrete 2D representation (array which has [n_points, 2, 1] for each sample) of an airfoil that has to be extruded to form a wing along the z axis which has parameters like Span and variation on chord length. In theory, this seems easy, however, in code, I can't find any basis on how to implement it.

I have not found anything regarding this which doesn't use high utility libraries. Any leads or explanations will be highly appreciated.

$\endgroup$
6
  • 2
    $\begingroup$ What exactly is it that you are struggling with? Seems quite straightforward to me: Evaluate the curve at certain coordinates and connect the data points with triangles. Since I guess this is a homework question, I suggest studying the material from the course first. Telling us a bit more about what particular problems you are facing with this task will help us to guide you in the right direction. $\endgroup$
    – wychmaster
    Apr 26 at 15:36
  • $\begingroup$ @wychmaster I have updated the question. This is for my undergrad project. I am making a Generative Neural network architecture that outputs an extruded form of the 2d discrete representation ie a 3d model representation of the same. This is why I can't use a high utility library like blender or pygimli since they cant be part of model architecture. $\endgroup$
    – sarva
    Apr 27 at 17:06
  • $\begingroup$ Sorry, for returning so late, but I am currently very busy. If you have discrete points in 2d I am still not seeing what your exact problem is. To keep it simple, let's assume you have a rectangular wing. Your 2d coordinates are x and y. Now create two copies of those coordinates and add a z coordinate. The first profile gets z=0 and the second z=l, where l is the wingspan. Now connect the points with triangles to get a surface. I might be able to give you a full answer if this isn't enough, but it might take a while. $\endgroup$
    – wychmaster
    Apr 30 at 9:15
  • $\begingroup$ @wychmaster What exactly do you mean by triangles? As in triangular tesselation? Because I am trying to make a perfect boundary representation one. $\endgroup$
    – sarva
    May 1 at 19:42
  • $\begingroup$ Let's say you have two times the same airfoil with just different z coordinates. We name the first one A and the second one B. Then you can create 2*N triangles from it, where N is the number of airfoil raster points, the first two triangles would be (A[1], A[2], B[1]) and (B[1], B[2], A[2]). Then just add just 1 to all indices for the next ones. The last triangles would be (A[N], A[1], B[N]) and (B[N], B[1], A[1]). (Note that I started indexing with 1 and not with 0) $\endgroup$
    – wychmaster
    May 6 at 7:40
2
$\begingroup$

You can't create a solid by extruding a single curve or set of curves. Even if they are closed. Think about a circle on on the XY plane. If you extrude the circle along the Z axis you have an uncapped cylinder.

Let's walk it back a bit though. If you have a single Bezier curve and extrude it you create a Bezier surface. You can quickly get your head around a Bezier surface if you understand a Bezier curve.

https://en.wikipedia.org/wiki/B%C3%A9zier_surface

You can think of the Bezier surface as a blend through a set of curves. To extrude the curve you simply duplicate your original curve, and set the control points Z value to your extrusion distance. The original curve and new extruded curve create the control points for your surface.

I actually have a Bezier surface example I wrote in Python. The only dependencies are Numpy and Matplotlib. It also uses the Bernstein Basis function imported from another file in the repository. You can play with the control points to see how modifying them effects the resulting surface. There's no error checking so you'll have to know what you're doing.

https://github.com/jrz371/IntroToNurbsPython/blob/master/BezierSurface.py

As for parameterizing the span and chord length you'll have to derive those yourself. I'm unfamiliar with your requirements. Understanding the Bezier curves and surfaces thoroughly should help you resolve that.

Some of the comment suggest evaluating the curve and creating triangles. This is a bad approach. Tessellating a Bezier surface causes you to lose a lot of information. The Bezier surface is smooth whereas a set of triangles is not. For drawing a Bezier surface they are ultimately tessellated for the display, but they are kept in the original Bezier representation for modification.

Bezier curves are also not the best representation for curves and surfaces. BSplines and NURBS are able to represent more complex surfaces and curves. Understanding Beziers is fundamental prerequisite before tackling those.

Good luck!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.