Link to home
Create AccountLog in
Math / Science

Math / Science

--

Questions

--

Followers

Top Experts

Avatar of DBTechnique
DBTechnique

NURBS - How to get surface points based on constant step
I have a NURBS with control points Pw and two knot vectors U and V. Now I am wondering how to sample the surface if I need a point every X millimeters on u direction and Y millimeters on v direction. I would like to generate such "grid" and be sure that the distance between two consecutive points on the grid is either X or Y. I have thought of oversampling in both direction and then saving only the points that fit. However, it will require a lot of computation. Does anyone know of a smart algorithm ? Thank you.

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of GwynforWebGwynforWeb🇨🇦

You can't in general put such a grid on a curved surface. If you are thinking of grids like this:-

http://www.phasespace.com.au/surface_ex.htm

Then all that is done is that a grid from the pane is mapped onto to the surface.  For NURBS you will probably get a pleasing effect with points corresponding to a grid of equidistant parameters values u & v.

Avatar of DBTechniqueDBTechnique

ASKER

The grid I am looking for is one where each intersection of the grid is equidistant from any of the consecutive intersection.
In the example you gave, the grid is "deformed" when the surface has also deformation of the surface.
We can see that especially on the tall peak in  the images in the link you gave.
I already have a rendering of the NURBS which is indeed using equidistant parameters values for u and v, but I get the same result as the image.
In this article :

Arc length parametrization

We see such method applied on splines curve using approximation method.
Is there such approach for surface ?

Avatar of GwynforWebGwynforWeb🇨🇦

The simple answer to your question is no it can't in general be done on a surface. Visualize trying to do it on a hemisphere.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


I understand what you mean, but in the case of a hemisphere, we can have a grid with constant arc length if the grid is made with triangle, right ?
I understand that this is a special case and in a generic case, it will not be true.

Is there a method that would flatten a surface on a plane, while deforming it depending on the derivate, so that we could map on this plane a square grid and retrieve the u,v parameters values at those grid intersections ?

The NURBS I have to work with are more or less flat, so the case of conics is not part of my problem.
User generated imageIn case, this is still impossible to do, do you have any ideas about what I can change in the problem constraints so that it would be possible ?
For example, working with Bezier's surface, not constant steps but with a tolerance...

Also, in this link http://zjw.public.iastate.edu/papers/2002-ijnmf.pdf, they explain the following :

"If one is interested in dealing with NURBS or IGES patches, one approach is to generate
a ‘structured grid’ for the patch using the local co-ordinates in the parameter space. This
structured grid is then subdivided into a triangulated surface. This triangulated surface can be
viewed as a ‘nite resolution’ representation of the true NURBS or IGES patch."

Avatar of ozoozo🇺🇸

Using triangles instead of rectangles doesn't help, even for spherical surfaces, unless the triangles form one of the Platonic solids.
But relaxing the constant distance requirement makes possible many solutions.

Thanks Ozo for the information.
Do you have any methods in mind that could be applied on this problem ?

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of GwynforWebGwynforWeb🇨🇦

A surface can be mapped onto the plane by using a projection of some description. This is done in texture mapping for computer graphics. The easiest is to simply take the (x,y) coordinates of a point, the grid will still be deformed.

I remember thinking about this problem some years ago and did not get very far with it. Since your surfaces are close to flat, mapping a grid on the plane up onto the surface is probably as good as you'll get. Though solving for (u,v) for a given (x,y) is not a trivial task.

I should also add that grid deformation gives extra visual cues as to how the surface is behaving. Removing or minimizing deformation may produce worse results than you had before.

Avatar of ozoozo🇺🇸

Without the equidistant constraint, and without having defined other constraints,
I'm not sure why we can't define the grid in terms of (u,v) rather than (x,y).

Hi Gwyn,

The method you are describing was my first approach of the problem but as you stated, the grid will still be deformed.
As I have to do one-time calculation before saving the output points (computation time is not a constraint, nor is the memory consumption), I thought about generating all the points of the surface with a really small step on u and v, and then saving only the points which respect a constant step on X and Y direction, I guess it would provide the same results as mapping.
I agree with you that finding {u,v} for a couple {x,y} is not trivial, tried to do it and got lost in the calculations...

I saw and verified by myself that some plugin of CATIA software could generate a tool-path from a surface with constant distance between two points of the tool-path. Generating a tool-path is the objective of my software (same as in CNC machining but for another type of applications) and I don't care about rendering.

Today, I read and implemented the method in the following article on a Bezier's curve :
http://zbc.uz.zgora.pl/Content/2570/5madi.pdf

It is working for Bezier's curve.
I am now wondering about a method to generate Bezier's curve from my NURBS surface and apply this algorithm at least on one direction.
For example :
1- Sample the surface on u,v and saved lines of points sharing same Y values (output is an array of lines with different Y values, using a specified Y step).
2- Convert those NURBS lines to piecewise Bezier's curve
3- Apply the approximation algorithm on each curve
4- Resolve missing points in-between curves if the arc-length is not respected
5- Generate the NURBS curve from the piecewise Bezier's curve by global interpolation

Then do the same on the X direction, and try to do something from the results.
Might be a dead-end, but I have nothing to lose trying.

I am still interested about Ozo's comments as it seems he knew about some possible solutions when loosing up on the step constraint.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Ozo,
I can accept to not follow the constant step constraint, but only if a tolerance is allowed.
For example, if a 1 millimeters step is specified, I can accept 1.1 millimeters, but if the step is 2, then 2.5 millimeters would not be acceptable.
The best would be to be able to input the tolerance value as the constraint on the step

Avatar of ozoozo🇺🇸

Without constraints, there could be an infinite number of solutions.
Part of the problem is defining enough constraints to narrow down the solutions to a particular one of interest.
Another is to define that those constraints in such a way that the solution is practical to compute.
An mentioned, one possibility may be to define the points in terms of x,y
this may work as long as the surface is flat enough that it never folds back over itself in such a way that there are more than one set of u,y values for a given x,y.
Computationally, the simplest method to find u,v for a given x,y may be an iterative method,
perhaps like a binary search or Newton's method.
For a reasonably flat surface, either of those might work well, as where they get into trouble tends to be at the fold points.

"as long as the surface is flat enough that it never folds back over itself in such a way that there are more than one set of u,y values for a given x,y"
That's the case.

"Computationally, the simplest method to find u,v for a given x,y may be an iterative method,
perhaps like a binary search or Newton's method."
No fold points so would work and when tolerance is not achieved, just need to interpolate between two output points considering the specified step is small enough.

Aren't there any more elegant method or it is that simple "computationally" speaking with those constraints ?

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of ozoozo🇺🇸

Binary search should be pretty simple, and shouldn't take very may iterations unless very high precision is required.  Newton-Raphson converges even faster, and may be more than sufficient elegance for this purpose.
I haven't looked closely at the algebraic problem of solving for u,v given x,y, but GwynforWeb saying it's not trivial makes me think it's not worth trying.

ASKER CERTIFIED SOLUTION
Avatar of GwynforWebGwynforWeb🇨🇦

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Thanks Gwyn
Math / Science

Math / Science

--

Questions

--

Followers

Top Experts

The Math / Science topic primarily includes discussions of mathematics, physics, statistics and economic analysis, but also biology, chemistry and other sciences.