CG Class 25, Mon 2018-11-26

1   ACM SIGSPATIAL GIS Cup 1st place

Here.

In 2016, we won 2nd. We also won 2nd in 2015.

3   Chapter 14

  1. Curves are the next chapter of Angel. WebGL does this worse than full OpenGL. Here is a summary. Big questions:

    1. What math to use?
    2. How should the designer design a curve?
    3. My notes on Bezier curves.
  2. Partial summary:

    1. To represent curves, use parametric (not explicit or implicit) equations.

    2. Use connected strings or segments of low-degree curves, not one hi-degree curve.

    3. If the adjacent segments match tangents and curvatures at their common joint, then the joint is invisible.

    4. That requires at least cubic equations.

    5. Higher degree equations are rarely used because they have bad properties such as:

      1. less local control. Changing one control point of a hi-degree curve changes the whole curve. Parts of the curve distant from that point may move a lot. This makes designing a desired curve impossible.
      2. numerical instability. Small changes in coefficients cause large changes in the curve, even if computations are exact.
      3. roundoff error. Computations are not exact.
    6. See my note on Hi Degree Polynomials.

    7. One 2D cartesian parametric cubic curve segment has 8 d.f. in 2D (12 in 3D).

      \(x(t) = \sum_{i=0}^3 a_i t^i\),

      \(y(t) = \sum_{i=0}^3 b_i t^i\), for \(0\le t\le1\).

    8. Requiring the graphic designer to enter those coefficients would be unpopular, so other APIs are common.

    9. Most common is the Bezier formulation, where the segment is specified by 4 control points, which also total 8 d.f.: P0, P1, P2, and P3.

    10. The generated curve starts at P0, goes near P1 and P2, and ends at P3.

    11. The curve stays inside the control polygon, the convex hull of the control points. A flatter control polygon means a flatter curve. Designers like this.

    12. A choice not taken would be to have the generated curve also go thru P2 and P3. That's called a Catmull-Rom-Oberhauser curve. However that would force the curve to go outside the control polygon by a nonintuitive amount. That is considered undesirable.

    13. Instead of 4 control points, a parametric cubic curve can also be specified by a starting point and tangent, and an ending point and tangent. That also has 8 d.f. It's called a Hermite curve.

    14. The three methods (polynomial, Bezier, Hermite) are easily interconvertible.

    15. Remember that we're using connected strings or segments of cubic curves, and if the adjacent segments match tangents and curvatures at their common joint, then the joint is invisible.

    16. Matching tangents (called \(G^1\) or geometric continuity) is sufficient, and is weaker than matching the 1st derivative (\(C^1\) or parametric continuity), since the 1st derivative has a direction (tangent) and a length. Most people do \(C^1\) because it's easier and good enough. However \(G^1\) gives you another degree of freedom to use in your design.

    17. Similarly, matching the radius of curvature (\(G^2\) or geometric continuity) is weaker than matching the 2nd derivative (\(C^2\) or parametric continuity), but most people do parametric continuity.

    18. Parametric continuity reduces each successive segment from 8 d.f. down to 2 d.f.

    19. This is called a B-spline.

    20. From a sequence of control points we generate a B-spline curve that is piecewise cubic and goes near, but probably not thru, any control point (except perhaps the ends).

    21. Moving one control point moves the adjacent few spline pieces. That is called local control. Designers like it.

    22. One spline segment can be replaced by two spline segments that, together, exactly draw the same curve. However they, together, have more control points for the graphic designer to move individually. So now the designer can edit smaller pieces of the total spline.

    23. Extending this from 2D to 3D curves is obvious.

    24. Extending to homogeneous coordinates is obvious. Increasing a control point's weight attracts the nearby part of the spline. This is called a rational spline.

    25. Making two control points coincide means that the curvature will not be continuous at the adjacent joint.

      Making three control points coincide means that the tangent will not be continuous at the adjacent joint.

      Making four control points coincide means that the curve will not be continuous at the adjacent joint.

      Doing this is called making the curve (actually the knot sequence) Non-uniform. (The knots are the values of the parameter for the joints.)

    26. Putting all this together gives a non-uniform rational B-spline, or a NURBS.

    27. A B-spline surface is a grid of patches, each a bi-cubic parametric polynomial.

    28. Each patch is controlled by a 4x4 grid of control points.

    29. When adjacent patches match tangents and curvatures, the joint edge is invisible.

    30. The surface math is an obvious extension of the curve math.

      1. \(x(u,v) = \sum_{i=0}^3\sum_{j=0}^3 a_{ij} u^i v^j\)
      2. \(y, z\) are similar.
      3. One patch has 48 d.f. for Cartesian points, or 64 d.f. for homogeneous points, although most of those are used to establish continuity with adjacent patches.
  3. My extra enrichment info on Splines.

  4. The program I showed earlier is robotArm is Chapter 9.

  5. To run program figure there, you may first need to fix an error in figure.html. Change InitShaders to initShaders.

    Many of the textbook programs have errors that prevent them from running. You can see them in the console log.