# Offset of curves. Alina Shaikhet (CS, Technion)

## Presentation on theme: "Offset of curves. Alina Shaikhet (CS, Technion)"— Presentation transcript:

Offset of curves. Alina Shaikhet (CS, Technion)
Computer Aided Geometric Design (236716) Center for Graphics and Geometric Computing, Technion

Center for Graphics and Geometric Computing, Technion
Plan General introduction. Planar Curve Offset based on Circle Approximation. Offsets of 2D Profiles. Computing Offset of B-Spline curves. Center for Graphics and Geometric Computing, Technion

Center for Graphics and Geometric Computing, Technion
Introduction The offsetting is one of the most difficult geometric operations to implement. The exact offset curves and surfaces have very high algebraic degree compared with the original curves and surfaces. For a few simple curve types, the offset will take the same form as the curve; that is, the offset of a line is a line, and that of a circle is the circle. But this is not generally true: the offset of a polynomial is not a polynomial, and that of a spline is not a spline. Most offsets have to be approximated, preferably from the same space of functions used for the curves. Center for Graphics and Geometric Computing, Technion

Center for Graphics and Geometric Computing, Technion
Introduction Given a planar regular parametric curve , the offset curve (with respect to a fixed radius r) is defined by where is the unit normal of Due to the square root function in the denominator of N(t), the exact offset curves are not rational in general. For “Pythagorean hodograph curves” holds for some polynomial Their offset curves are rational. Center for Graphics and Geometric Computing, Technion

Center for Graphics and Geometric Computing, Technion
Introduction Previous offset computation methods for parametric curves approximated either: The original curve C(t) by line segments and circular arcs, or The offset curve Cr(t) by low degree polynomial curves. The offsets are also the line segments and circular arcs. Disadvantage: Many line segments and circular arcs are required to approximate a given planar curve. Center for Graphics and Geometric Computing, Technion

Center for Graphics and Geometric Computing, Technion
Introduction Let denote the radius of curvature of C(t), - the unit tangent vector to curve Cr at t0. - the unit normal to C at t0. if points away from the center of curvature or if does not exist if and points toward the center of curvature. (cusp point) if and points toward the center of curvature. (loop) So, if points toward the center of curvature, then the tangent of the offset will reverse the direction at Center for Graphics and Geometric Computing, Technion

Planar Curve Offset based on Circle Approximation.
In-Known Lee, Myung-Soo Kim and Gershon Elber.

Center for Graphics and Geometric Computing, Technion
Introduction Presented algorithm: Given: a planar parametric curve C(t) and an offset radius r. Goal: approximate planar offset curve Cr(t) within an arbitrary tolerance Approximate the circle of radius r by piecewise quadratic Bezier curve segments Q(s) with the tolerance . Convolve the given curve C(t) with the quadratic Bezier curve segments: Center for Graphics and Geometric Computing, Technion

Center for Graphics and Geometric Computing, Technion
Introduction Offset approximation error: The maximal value of , where is an approximation of Curve refinement is made in the parameter values which gives the maximum error. Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
The quadratic Bezier curve with three control points is given by: for Assume: The approximation error of the curve from the unit circle: for Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
Instead of using which has a square root term, we may use for As the approximation converges to the exact offset, we have: Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
As a 4-degree polynomial , has 5 extreme values at most. (assume D>1). Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
Method 1: tangent to the circle at both ends. Let , be the quadratic Bezier curve which is tangent to the circle at the end-points of the curve. Then: two adjacent curves meet with G1-continuity. the middle control point , thus , and while the maximum error occurs at with magnitude: Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
Error functions for five methods. always lies in the exterior of the circle. Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
Method 2: uniform scaling of the Method 1. Error function takes only non-negative values. Scale all the three control points of simultaneously by a certain magnitude. That is, the curve Is defined by: Error function: Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
, thus the two functions have extreme values at the same parameter values of s. Since , we have We minimize the approximation error by taking so that or equivalently, Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
Thus the values of is given by And the approximation error is given by the value: Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
Method 3: interpolating three circle points. Let pass through the mid-point of the circular arc; that is, we make: Two adjacent curves meet with G0-continuity. The resulting curve always lies in the interior of the circle. From follows Maximum errors are at with negative magnitude Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
Method 4: interpolating with equi-oscillating error. We want to make the error function has the same magnitude of maximum and minimum values: Thus, the corresponding value of is Maximum errors are obtained at Center for Graphics and Geometric Computing, Technion

Circle approximation with quadratic Bezier curve segments.
Method 5: uniform scaling of the Method 3. The curve of Method 3 is contained in the interior of the unit circle. This means that the error function takes only non-positive values. Let the curve be defined similarly to the Method 2: Where (note that ) Center for Graphics and Geometric Computing, Technion

Approximating planar offset curves.
Definition: Given two planar curves, their convolution curve is defined as the set of all vector sums generated by all pairs of curve points which have the same curve normal direction. Center for Graphics and Geometric Computing, Technion

Approximating planar offset curves.
A quadratic curve has a linear one-to-one hodograph curve Assume that the mapping is well defined. If and have the same direction, we have: and the parameter is uniquely determined by: Center for Graphics and Geometric Computing, Technion

Approximating planar offset curves.
The approximated offset curve is defined by: For a polynomial curve of degree d, the approximated offset curve is a planar rational curve of degree 3d-2. For a rational polynomial curve of degree d, the approximated offset curve is a rational curve of degree 5d-4. Center for Graphics and Geometric Computing, Technion

Wayne Tiller and Eric G. Hanson
Offsets of 2D Profiles Wayne Tiller and Eric G. Hanson

Center for Graphics and Geometric Computing, Technion
Introduction Let be a collection of curves such that the end point of Ci coincides with the start point of Ci+1. P is called a profile. No pairwise or self-intersections among the are allowed. Any of the curves is assumed to have a well-defined tangent vector at each point, and they are in nonuniform rational B-Spline representation. Center for Graphics and Geometric Computing, Technion

Offsetting a curve. Algorithm.
Denote by A1 the set of original control points of C, and by K1 the corresponding knot vector. Set i=1. Offset each “leg” of Ai ( as line segments) a distance r. Intersect the offset polygon legs in a pairwise manner. This yields a set, Bi of new control points. The , defined by Bi and Ki , is the i-th approximation to the offset of C. Check the deviation of from the true offset. If the deviation is greater than or equal to , make refinement to get Ai+1, Ki+1. Set i=i+1 and go to step Else – stop. Center for Graphics and Geometric Computing, Technion

Center for Graphics and Geometric Computing, Technion
Offsetting a curve. Lines and circles are offset precisely at i=1. Finding of cusps and loops during the process. Center for Graphics and Geometric Computing, Technion

Loop removal. (loop caused by )
Find a good approximation, Q’, to the self-intersection point of the loop by finding the intersections of the control polygon with itself. Use Newton’s method to improve the solution. This method also yields the two parameter values t1 and t2 (t1<t2) corresponding to the self-intersection point Q. Split the offset at t1 and t2 (using Boehm’s algorithm). Throw out the middle section (between t1 and t2). Q becomes a control point with multiplicity equal to the order of the basis functions, and t1, t2 are knots, each with multiplicity equal to order-1. Center for Graphics and Geometric Computing, Technion

Center for Graphics and Geometric Computing, Technion
Offsetting a profile. Process the curves of P in a pairwise fashion: (C1, C2), (C2, C3),…, (Cn-1, Cn). At each step, offset the two curves, process any loops and cusps, and join the offsets. Center for Graphics and Geometric Computing, Technion

Computing offsets of B-Spline curves.
Sabine Coquillart

Offsetting a curve. Algorithm.
As in a previous technique, the offset of a curve is defined by the curve of the same type, i.e. with the same knot vector and the same order. So only the new control points have to be defined. Each new control point is the offset of a control point of the original curve in the direction given by the normal at the closest point of the curve. The offset factor is related to both the curvature and the distance between the control point and its closest point on the curve. Center for Graphics and Geometric Computing, Technion

Offsetting a curve. Algorithm.
For each control point of C(t) define a control node - the closest point of the curve. The new control point is defined by the offset of the control point in the direction of the normal at the associated control node. Center for Graphics and Geometric Computing, Technion

Offsetting a curve. Algorithm.
Center for Graphics and Geometric Computing, Technion

Offsetting a curve. Algorithm.
Curvature is redefined as an average of the curvature at the control node and the curvatures are computed at half the distance between the control node and each of its two neighbor control nodes. Center for Graphics and Geometric Computing, Technion

Center for Graphics and Geometric Computing, Technion
Thank You! Center for Graphics and Geometric Computing, Technion