6
$\begingroup$

Given that I have implemented a function called calc_bspline_surf() in C, and that function has the following declaration:

calc_bspline_surf(ctrlnet, p, q, U, V, u, v)
/*
  ctrlnet --> control net of B-spline surface
  p, q --> degree of B-spline surface
  U, V --> the knots vector in two directions
  u, v --> parameter pair
*/

So for a pair of parameters {u, v}, corresponding B-spline surface coordinate could be generated via calling function calc_bspline_surf(u, v).

Here is a solution that sampling the 3D points uniformly in two direction

for u = {0, 0.05, ..., 1}
    for v= {0, 0.05, ..., 1}
       calc_bspline_surf(u, v)

enter image description here

However, how many 3D-points I need to sample? Is there classical sample strategy?

$\endgroup$
4
  • $\begingroup$ Your question header seems to ask a different question than the body of your question. So which is it? How to sample points or how many do you need to sample? $\endgroup$
    – joojaa
    Aug 6, 2016 at 16:13
  • $\begingroup$ @joojaa Sorry for my unclear description. My question originates from this question. For example, in Mathematica, I could use ParametricPlot3D[f[x, y], {x, 0, 1}, {y, 0, 1}] to draw a B-spline surface. $\endgroup$
    – xyz
    Aug 7, 2016 at 1:51
  • $\begingroup$ As joojaa points out, the question in your title is different from the rest of your question. Are you looking to only sample uniformly, and adjust only the size of the sample, or are you also interested in sampling in different ways, that may reduce the number of points required? $\endgroup$ Aug 7, 2016 at 16:11
  • $\begingroup$ @trichoplax Obviously, the uniformly sample is not a good method. My confusion is whether exist a specialized algorithm about sampling 3D-points and visualization for the B-spline surface. Please see this screenshots $\endgroup$
    – xyz
    Aug 8, 2016 at 1:15

1 Answer 1

3
$\begingroup$

Based on your linked question, the problem appears to be that you don't get enough samples in highly curved areas of the surface. You could increase the sample density everywhere, but then you oversample the flatter areas and it becomes too slow.

So, you need to increase the sample density locally in areas where it's needed. A conceptually simple algorithm for this is adaptive refinement. You would start out with a uniform sample grid in UV space. Then, detect grid squares in which the curvature is too high for the grid spacing (above some threshold), and subdivide them, adding additional samples in between the existing ones. This process can be repeated recursively on the new, smaller grid squares, subdividing as finely as the surface requires. You can tune the curvature threshold to balance fidelity versus performance.

Since B-splines (NURBS) are based on rational functions, I would guess that the maximum curvature in a region can be found (or at least bounded) analytically. This would be ideal, if possible, since it would avoid the problem of missing a small high-curvature area if none of the initial grid points happen to land in it. However, in a pinch the curvature can be estimated by looking at the sample points you've evaluated. For instance, if $p_1, p_2, p_3$ are three sample points collinear in UV space, they should be close to collinear as well, if the surface is adequately sampled. So, you could for instance evaluate $$\frac{\|p_2 - p_1\| + \|p_3 - p_2\|}{\|p_3 - p_1\|}$$ where the double bars mean vector length. If this is greater than some threshold value such as 1.1 or 1.5 (note that 1.0 would be perfectly flat), then you would subdivide the area between these points.

$\endgroup$
1
  • 2
    $\begingroup$ Most software define chord height as a subdivision criteria along with angle error (which is what you describe... ) . Reason being that usually in engineering solutions the tolerance is usually for deflection from true surface not how well the curvature is preserved. But there is many ways to skim the fish depenzing on what your needs are. Simple UV division can be bad for multipatched / trimmed surfaces. $\endgroup$
    – joojaa
    Aug 8, 2016 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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