Hot answers tagged

10 votes
Accepted

How do I accurately compute coverage of overlapping analytical curves?

There is really no good way of doing this efficiently analytically for all corner cases. Most or all commercial 2D renderers that attempt to do analytic coverage calculation make predictable errors ...
9 votes

Is there some kind of Bresenham algorithm or equivalent for scanline rendering a rotated ellipse?

All conics (including rotated ellipses) can be described by an implicit equation of the form H(x, y) = A x² + B xy + C y² + D x + E y + F = 0 The basic principle ...
user avatar
9 votes

Is there some kind of Bresenham algorithm or equivalent for scanline rendering a rotated ellipse?

The classic book Computer Graphics: Principles and Practice (second edition) by Foley, van Dam, et al. describes such an algorithm in section 19.2. The explanation in the book seems to come from an ...
user avatar
  • 714
7 votes
Accepted

How to calculate matching roundness of two offset rectangles?

What you (probably) want to achieve is something like this: When having a closer look at one of the corners and add a few lines, we see this: The black lines indicate that the center points of the ...
user avatar
  • 1,220
6 votes
Accepted

How do people come up with subdivision schemes?

The subdivision schemes are not arbitrary. Catmull-Clark, arguably the most used subdivision scheme, generalizes bicubic B-splines to meshes of arbitrary topology. Most, other subdivision schemes ...
user avatar
  • 967
6 votes
Accepted

Determining Rational Quadratic Bezier Curve Weights for Circle

Check out the section on Circular Arcs and Circles, from Ching-Kuang Shene's excellent computational geometry course notes: [G]iven three control points P0, P1 and P2 such that P0P1 = P1P2 holds, if ...
user avatar
  • 836
6 votes

Algorithms for scan converting b-spline and nurbs

Ignoring Non-uniform B-splines (rational or not), I have had some experience with rasterisation of Beziers and, since there is a trivial mapping from Uniform B-Splines to Beziers, those too. I have ...
user avatar
  • 3,986
6 votes

Ordering a set of unorganized points along a curve

You have an instance of a problem called curve reconstruction from unorganized points. Now that you know what to search for you'll find several methods, such as the crust, NN-crust, etc. Here are a ...
user avatar
  • 714
5 votes

Move position in smooth gradient

What you want is linear interpolation like @Tim points out. However he uses a formula that is not so easily understandable form, we can refactor it differently. Basically linear interpolation is a ...
user avatar
  • 8,169
5 votes
Accepted

Move position in smooth gradient

The math you need is linear interpolation. I think of a player sprite which moves from position X to position Y. Pseudocode: ...
user avatar
  • 518
5 votes
Accepted

Converting raster shape/blob into displacement map

One way I can think of is to make a "signed distance transform" of the image where there is information for each pixel about how far the pixel is to the closest surface of the shape. Since it's ...
user avatar
  • 7,361
4 votes
Accepted

If you can use subdivision surfaces for 2D curves

Subdivision can be used for curves in 2D just as easily as for surfaces in 3D. Usually the subdivision algorithms applied to 2D are called subdivision curves. Subdivision curves do not suffer from the ...
user avatar
  • 967
4 votes

Conversion from cubic catmull-rom spline to cubic b-spline

Quoting the comments above for context: Just to confirm, are you asking, given a set of $N$ CatRom control points, $$\{CR_0, CR_1, CR_2, CR_3 ... CR_{n-1}\}$$ forming a piecewise curve, what is the ...
user avatar
  • 3,986
4 votes

How to use Monotone cubic interpolation in 3D?

Ok, monotonic interpolation depends on what you are monotonic about. For a simple 1D function interpolation monotonicity is easy to define. But for a 2D and 3D dataset its not so self evident what the ...
user avatar
  • 8,169
4 votes

Ordering a set of unorganized points along a curve

After some clarifications, there is probably a much better approach that doesn't even require knowing the parametric form of the curve, and also avoids the potentially problematic numeric minimisation ...
user avatar
  • 2,580
3 votes

How to take the derivative of a Bézier curve?

A simple example of taking a the derivative of a B'ezier curve can be shown using a cubic curve. $$C_3(u) = \sum_{i=0}^3 B_{3,i}(u) P_i,$$ where $u \in [0,1]$ and $B_{n,i} = {n \choose i} u^i (1-u)^{n-...
user avatar
  • 967
3 votes
Accepted

Polygons versus curve primitives in software rendering

Most software rendering engines dice the parametric primitives to micropolygons, usually on the fly as needed. In essence this reduces the needed complexity to determine intersections. The surface ...
user avatar
  • 8,169
3 votes

Ordering a set of unorganized points along a curve

Since you've only got floating-point representations of the points, there is no guarantee that these still lie exactly on the curve, due to rounding errors. So I think the only generic approach is to ...
user avatar
  • 2,580
2 votes

Does the blending matrix change between calculating various curve segments in a uniform cubic B-splines approximation?

No, $B$ is constant for given type of cubic spline, e.g. B-spline, Bezier, Hermite or Catmull-Rom cubic splines have different $B$ matrix. To make B-spline continuous, you need to copy 3 control ...
user avatar
  • 3,566
2 votes
Accepted

Does the blending matrix change between calculating various curve segments in a uniform cubic B-splines approximation?

No, the $B$ matrix (basis coefficient matrix) does not change from one segment to the next. It is a property of the type of spline you're using, in this case cubic B-splines. If you used Bézier ...
user avatar
  • 23.7k
2 votes
Accepted

How to deform some mesh so that it fits along a spline curve?

I have no knowledge of the literature on the topic, but I did something very similar to what you're asking some time ago: I wanted to generate lathe meshes and bend them according to a spline. I think ...
user avatar
2 votes
Accepted

B spline curve generation in Python

In line 15 use the half-open interval, i.e., if u>=t[0][i] and u<t[0][i+1]: Otherwise, at knot values, you evaluate two basis functions at the k=1 basis ...
user avatar
2 votes
Accepted

Why cubic curves provide the minimum curvature interpolants?

For a function $y = f(x)$ the (signed) curvature at $x$ is given by: $$ \kappa(x) = \frac{f''(x)}{(1+f'^2(x))^{\frac{3}{2}}} $$ If you assume that the slope is very small compared to $1$: $ f'^2<\!...
user avatar
  • 1,837
2 votes

Why cubic curves provide the minimum curvature interpolants?

Splines confuse me which is one reason I asked somebody else to write that chapter. But I like this explanation: https://www.johndcook.com/blog/2009/02/06/the-smoothest-curve-through-a-set-of-points/
user avatar
1 vote

Continuity of parametric and geometric continuity

I would rather draw the $G_1$ example something like this: This makes it clear that $t_2$ and $t_3$ are parallel, but have different lengths in general. (They both start at the same point, but $t_3$ ...
user avatar
  • 23.7k
1 vote

Spline interpolation library in cpp

So you have a series of points and, at each point, a supplied derivative? Is a piecewise cubic sufficient or does it need higher derivative continuity? If the former is ok, then Cubic Hermite Splines ...
user avatar
  • 3,986
1 vote

How do you compute the winding number of a closed poly curve?

Winding number as in https://en.wikipedia.org/wiki/Winding_number? Unless I'm mistaken, one way is to fire, say, a horizontal 'ray' out from your point towards, say, $+\infty$. Each time you cross an ...
user avatar
  • 3,986
1 vote

Non least squares formulation to fit catmull rom spline

Disclaimer: I've done some work in the past with wavelet decomposition of image data but it occurred to me that it may be applicable to your problem. Admittedly, I don't actually know if the ...
user avatar
  • 3,986
1 vote
Accepted

How does the Lane Riesenfeld algorithm work?

What you're looking for is called de Boor's algorithm. It lets you compute a point on a b-spline curve by doing a series of linear interpolation (LERP) calculations. So, it works very much like the de ...
user avatar
  • 330

Only top scored, non community-wiki answers of a minimum length are eligible