orbingol / NURBS-Python

Object-oriented pure Python B-Spline and NURBS library
https://onurraufbingol.com/NURBS-Python/
MIT License
603 stars 153 forks source link

Visualizing surface without ordering control points #169

Open thoeschler opened 10 months ago

thoeschler commented 10 months ago

Hi!

is it possible to visualize a surface without specifying the number of control points in the respective directions u and v? Mathematically, this is not required for visualization.

In my example I simply have a list of control points in random order. The examples in https://github.com/orbingol/geomdl-examples/tree/master/surface require that the points are given in a specific order.

Best regards, Thilo

orbingol commented 10 months ago

Hi @thoeschler,

Just for visualization of the surface, the only thing you need is the evaluated points, i.e. evalpts property. Control points, knot vectors and polynomial degree are required to compute the evaluated points. For sure, it is possible to visualize the control point grid alone and even add the parametric dimensions to that graph, if it makes sense.

The order of control points or evaluated points is not required for visualization. You can run a tessellation algorithm on the points (most assume the input as a point cloud) or just visualize the points as small spheres or use any external visualizer, e.g. Paraview. The visualizers in the geomdl.visualization package are just examples which are created with the intention of illustrating extensibility options.

Hope these help.

thoeschler commented 10 months ago

Hi, thanks for your answer. I actually mixed something up. For surface definition you have to order the control points. I found a way to get them in ordered form.

I have another question. Is it already possible to plot both curves and surfaces in the same figure? CurveContainer and SurfaceContainer and render only work for either of the two.

orbingol commented 10 months ago

For evaluation of the surface, yes, you have to have the ordered points, but you asked for visualization, and it is not necessary to order any points for that.

Containers does not support containing or visualization of mixed geometries at this time. You may extend the base class and add any feature you would like to.