1 / 12

Beziers and Other Splines Petzold – Chapter 13

Beziers and Other Splines Petzold – Chapter 13. Jim Fawcett CSE778 – Advanced Windows Programming. Definitions. Spline: A curve defined by formula used to represent a segment of some complex figure. Bezier Spline:

ferris
Download Presentation

Beziers and Other Splines Petzold – Chapter 13

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Beziers and Other SplinesPetzold – Chapter 13 Jim Fawcett CSE778 – Advanced Windows Programming

  2. Definitions • Spline: • A curve defined by formula used to represent a segment of some complex figure. • Bezier Spline: • A Cubic polynomial defined by four points. Each end of the Bezier passes through one of the points and is tangent to the line between that point and one of the others.

  3. http://www.moshplant.com/direct-or/bezier/ second control point. first control point. first end point. second end point.

  4. The Math • Parametric Form:x(t) = (1-t)3x0+3t(1-t)2x1+3t2(1-t)x2+t3x3y(t) = (1-t)3y0+3t(1-t)2y1+3t2(1-t)y2+t3y3where: • (x,y) are coordinates of a point • t is a distance along the curve with 0 < t < 1

  5. Drawing Beziers • System.Drawing.Graphics • DrawBezier(Pen,Point,Point,Point,Point) • DrawBezier(Pen,Pointf,Pointf,Pointf,Pointf) • DrawBezier(Pen,Point[]) • DrawBezier(Pen,Pointf[])

  6. Some Examples • Bezier Manual • Bezier Clock

  7. Colinear Beziers • So how do we effectively connect several Bezier splines to make a more complex line? • To join smoothly, the slopes must match at boundry points. • To do that make the following three points colinear: • Second control point of the first Bezier • The end of the first Bezier (same as the begininng of the second Bezier) • The first control point of the second Bezier

  8. Joining Beziers • Infinity Symbol • To Draw N Bezier Curves the number of points in the array must be 3N+1: DrawBezier(Pen, Point[])

  9. Canonical Splines • A canonical spline passes through all points that define it. • The curve between adjacent points is called a segment. • Each internal segment is affected by the points at its ends and the next two enclosing points. • The shape of the segment is also controlled by its tension, usually between 0 and 1 that controls how “curvey” the segment appears.

  10. Visualizing the Canonical Spline • System.Drawing.Graphics • DrawCurve(Pen, Point[]) • DrawCurve(Pen, PointF[]) • DrawCurve(Pen, Point[], float) • DrawCurve(Pen, Pointf[], float) • Canonical Spline Tension

  11. Filling Closed Curves • System.Drawing.Graphics • DrawClosedCurve(Pen, Point[]) • DrawClosedCurve(Pen, PointF[]) • DrawClosedCurve(Pen, Point[], float, FillMode) • DrawClosedCurve(Pen, PointF[], float, FillMode) • FillMode: Alternate, Winding • Closed Curve Fill • See page 645 for the Math. Tension

  12. End of Presentation

More Related