Difference between catmull-clark and (nurbs or B-spline patches) - computational-geometry

Catmull-Clark works for arbitrary polygon meshes, which seems it is the superset of NURBS or equal to B-spline patches.
However, the method converges to bicubic B-spline surfaces based on WIKI. What is the relationship between those?

Related

Sampling methods for plotting

Say we are making a program to render the plot of a function (black box) provided by the user as a sequence of line segments. We want to get the minimum number of samples of the function so the resulting image "looks" like the function (the exact meaning of "looks" here is part of the question). A naive approach might be to just sample at fixed intervals but we can probably do better than that eg by sampling the "curvy bits" more than the "linear bits". Are there systematic approaches/research on this problem?
This reference can be helpful which is using the combined sampling method. Before that its related works explain more about other methods of sampling:
There are several strategies for plotting the function y = f(x) on interval Ω = [a, b]. The
naive approach based on sampling of f in a fixed amount of the equally spaced points is
described in [20]. The simple functions suffer from oversampling, while the oscillating curves
are under-sampled; these issues are mentioned in [14]. Another approach based on the interval
constraint plot constructing a hull of the curve was described in [6], [13], [20]. The automated
detection of a useful domain and a range of the function is mentioned in [41]; the generalized
interval arithmetic approach is described in [40].
A significant refinement is represented by adaptive sampling providing a higher sampling
density in the higher-curvature regions. The are several algorithms for the curve interpolation preserving the speed, for example: [37], [42], [43]. The adaptive feed rate technique
is described in [44]. An early implementation in the Mathematica software is presented in
[39]. By reducing data, these methods are very efficient for the curve plotting. The polygonal approximation of the parametric curve based on adaptive sampling is mentioned in the
several papers. The refinement criteria, as well as the recursive approach, are discussed in
[15]. An approximation by the polygonal curves is described in [7], the robust method for
the geometric and spatial approximation of the implicit curves can be found in [27], [10], the
affine arithmetic working in the triangulated models in [32]. However, the map projections
are never defined by the implicit equations. Similar approaches can be used for graph drawing
[21].
Other techniques based on the approximation by the breakpoints can be found in many
papers: [33], [9], [3]; these approaches are used for the polygonal approximation of the closed
curves and applied in computer vision.
Hence, these are the reference methods that define some measures for a "good" plot and introduce an approach to optimize the plot base on the measure:
constructing a hull of the curve
automated detection of a useful domain and a range of the function
adaptive sampling: providing a higher sampling density in the higher-curvature regions
providing a higher sampling density in the higher-curvature regions
approximation by the polygonal curves
affine arithmetic working in the triangulated models
combined sampling: providing the polygonal approximation of the parametric curve involving the discontinuities will be presented. The modified method will be used for the function f(x) reconstruction and plot. Based on the ideas of splitting the domain into the subintervals without the discontinuities, it represents a typical problem solvable by the recursive approach.

Calculating principal curvature directions on discrete mesh without quadratic fitting

I am working with 2d surfaces embedded in 3d, with a discrete triangulation, and would like to calculate to principal curvature directions (eigenvectors of the curvature tensor). What I already know is summarised in the following post: How to get principal curvature of a given mesh?. Basically, they talk about fitting points to a quadratic polynomial, and then diagonalising the obtained quadratic form.
My question is, is there any faster way of finding the eigenvectors? I have to do this over and over again, hence the need for speed. It is easy to find out the eigenvalues of the curvature tensor, namely the Gaussian curvature (using angular deficits) and Mean curvature (using the Laplacian). Are there any existing simpler algorithms for the eigenvectors?
PS: I am working in Python, if that helps.
When you know an Eigenvalue e of a 3x3 matrix M, an Eigenvector is given by the cross product of two columns of M - e.I, which is low cost.
To avoid degenerate cases, it is better to choose the pair of columns that yields the longest vector, but this triples the cost.
To avoid quadratic surface fitting and estimate principal curvatures and directions in a point of triangular mesh, one can use vertex normals in addition to vertex coordinates as described in the article Estimating Curvatures and Their Derivatives on Triangle Meshes by Szymon Rusinkiewicz.
See this answer for more detail.

In triangulation, what are the geometric interpretations of midpoint algorithm, homogeneous linear least squares and nonlinear least squares method?

In "Multiple View Geometry in Computer Vision" Chapter 12. Structure Computation, page 310-313, triangulation is used for point 3D reconstruction. There are three methods mentioned:
Midpoint method that "finds the midpoint of the common perpendicular to the two rays in space".
Linear triangulation methods that uses SVD to solve homogeneous equation Ax = 0. In this method algebraic error is minimized.
Nonlinear triangulation method that uses iterative optimization algorithms e.g. LM to solve a nonlinear least square equation Ax = b. The "gold standard" reprojection error is minimized.
My question is:
What are the geometric interpretations of the three methods?
What are the differences between the three triangulation methods above?
I did some research and found some useful information:
This post explains that algebraic error assumes noise comes from 3D points, while reprojection error assumes noise comes from 2D image
These slides introduce three methods but did not provide explicit geometric interpretations.

How to find the intersection point of a 3D curve and a 3D surface?

I am trying to find the intersection point of a curve and a 3D surface with no luck. The surface is in the shape of a cone, and the curve is hyperbolic, as are shown in the figure.
CONE AND THE CURVE
This simulates a ray hits a certain surface. I tried to use bisection method, but it doesn't seem to work. then I tried newton's algorithm, but the results are still not good.
Is there any other good algorithms out there which are suitable for solving this kind of problem?
With the curve given in parametric form
x = fx(t)
y = fy(t)
z = fz(t)
and the surface by one equation of the form
g(x,y,z) = 0
just plug in the curve functions and bisection should work:
g(fx(t), fy(t), fz(t)) = 0
The only problem is to find suitable starting points t1 and t2 where g has opposite sign.
Problem
You are searching for a curve-surface intersection algorithm. Note that both curves and surfaces can be represented in either implicit form or in parametric form. Surface in implicit form is defined by equation F(x, y, z) = 0, which is a quadratic polynomial of x, y, z in case of conic surface. Surface in parametric form is defined by point-valued function S(u, v) of its parameters (e.g. you can use distance along cone axis and polar angle as parameters of conical surface). Curve is usually described only in parametric form, as a function C(t) with parameter t, which could be quadratic for a hyperbolic curve.
Implicit surface
The simplest cases of all is to treat your problem as an intersection of parametric curve against implicit surface. In this case you can write down a single equation q(t) = F(C(t)) = 0 with single variable t. Of course, Newton's iteration is not guaranteed to find all solutions in general case, bisection can only surely find one solution if you find two points with different sign of q(t).
In your case q(t) is a quartic polynomial (after putting quadratic curve parametrization into quadratic surface equation). It can be theoretically solved with Ferrari's analytic formula, but I strongly advise against it, because it is quite unstable numerically. You can apply any popular polynomial solver here, like Jenkins-Traub algorithm or eigenvalues algorithm for companion matrix (also see this question). You can also use methods of interval mathematics: for example, you can recursively subdivide the domain interval of parameter t into smaller pieces, while pruning all the pieces that surely do not contain zeros (interval arithmetic would help you to detect such pieces).
Parametric surface
Now we can move on to the case when both the curve and the surface are represented parametrically. I do not know any solutions that could benefit from the fact the your surface is conical and your curve is hyperbolic, so you have to apply the general curve-surface intersection algorithm. Alternatively, you can fit an implicitly-defined cone into your parametric surface, then use the solution above for quartic polynomial roots.
A lot of reliable general intersection algorithms are based on the subdivision method (which is actually interval mathematics again). The general idea is to continiously divide the curve and the surface into smaller and smaller pieces. The pairs of pieces which surely do not intersect are dropped as soon as possible. At the end you'll have a set of small piece pairs, tightly bounding your intersection points. Yoy might want to run Newton's iteration from them in order to make intersection points precise.
Here is the outline of a sample algorithm:
Start with a single curve piece (the whole input curve) and a single surface
piece (whole surface), and one potentially intersection pair (PIP) of these pieces.
Subdivide each curve piece into two halves (by parameter), subdivide each surface piece into four quadrants (by both parameters).
For each old PIP check all 8 pairs of curve half vs surface quadrant. If they surely do not intersect, forget them. If they can intersect, save them as a new PIP.
Unless all pieces are small enough, repeat from step 2 with new pieces and PIP-s.
For each pair of curve piece and surface piece, you have to check whether they can potentially intersect, which can be easily done by checking their axis-aligned bounding boxes. Also, you can represent your curves and surfaces as NURBS, in which case you can use convex hulls as tighter bounding volumes.
Generally, there are tons of variations and improvements of this algorithms. I advise the following literature for deeper knowledge:
Shape interrogation for computer-aided design and manufacturing.
chapter 4: for root solvers
section 5.7: for curve-surface intersection
PhD of Michael Hohmeyer.
section 4.5: for curve-surface intersection
sections 4.1 and 4.2: for convex hulls intersection (if you are brave enough).
Bottom line
If you are seeking for a simple and working solution, and you are sure that hyperbolas and cones are the only things you have to worry about, then you'd better use implicit definition of cone and solve quartic equation with some standard numerical algorithm from a good library available to you.

How to draw bounded b-spline surface in OpenGL?

I want to draw a bounded b-spline surface with 26 b-spline boundary curves.
I can draw b-spline surface (without any boundary) in OpenGL, but it is too difficult for me to draw surface and fit the boundary curves.
Any suggestions or ideas are appreciated.
https://drive.google.com/file/d/0ByjklWbi44oBZDhocGdNLWNvUWM/view?usp=sharing
PS: The Files is a sample in .stp format
B-spline surfaces are naturally bounded. So when you say B-spline surface without any boundary, I think you are talking about untrimmed B-spline surfaces and what you want to do is to be able to draw trimmed B-spline surfaces.
Drawing a surface typically involves tessellation, which turns a continuous surface into a triangle mesh consist of many small triangles. Therefore you will need to do the following:
Find the surface parameter curve (SP curve) of the boundary curves. The SP curve is a 2D curve defined on the parametric domain of the B-spline surface.
Tessellate the 2D region on the parametric domain enclosed by all SP-curves.
Map the 2D tessellation on parametric domain back to 3D space to find the 3D triangle mesh.
Step 1 and step 2 are both non-trivial. So, indeed this will be a large task if you don't have any 3D library at your disposal and have to implement everything by yourself.

Resources