QwtBezier(3)

📦
version 6.3.0 · 2 versions
, in alpine 3.24

QwtBezier(3) 💅 — Library Functions Manual

✨ NAME ✨

QwtBezier — an implementation of the de Casteljau’s Algorithm for interpolating Bézier curves. 💖

🎀 SYNOPSIS 🎀

#include <qwt_bezier.h>

💕 Public Member Functions

  • QwtBezier (double tolerance=0.5) — Constructor. 🛠️
  • ~QwtBezier () — Destructor. 💀
  • void setTolerance (double tolerance)
  • double tolerance () const
  • QPolygonF toPolygon (const QPointF &p1, const QPointF &cp1, const QPointF &cp2, const QPointF &p2) const — Interpolate a Bézier curve by a polygon. ✨
  • void appendToPolygon (const QPointF &p1, const QPointF &cp1, const QPointF &cp2, const QPointF &p2, QPolygonF &polygon) const — Interpolate a Bézier curve by a polygon. ✨

🦋 Static Public Member Functions

  • static QPointF pointAt (const QPointF &p1, const QPointF &cp1, const QPointF &cp2, const QPointF &p2, double t)

🌸 Detailed Description 🌸

Okay so this whole thing is an implementation of the de Casteljau’s Algorithm for interpolating Bézier curves. 🎨

The flatness criterion for terminating the subdivision is based on "Piecewise Linear Approximation of Bézier Curves" by Roger Willcocks ( http://www.rops.org ).

This article explains the maths behind it in a very nice way: https://jeremykun.com/2013/05/11/bezier-curves-and-picasso

Definition at line 29 of file qwt_bezier.h.

🎀 Constructor & Destructor Documentation 🎀

QwtBezier::QwtBezier (double tolerance = 0.5)

Constructor. 🛠️

Parameters:

  • tolerance — Termination criterion for the subdivision.

See also: setTolerance()

Definition at line 116 of file qwt_bezier.cpp.

QwtBezier::~QwtBezier ()

Destructor. 💀

Definition at line 123 of file qwt_bezier.cpp.

💜 Member Function Documentation 💜

void QwtBezier::appendToPolygon (const QPointF & p1, const QPointF & cp1, const QPointF & cp2, const QPointF & p2, QPolygonF & polygon) const

Interpolate a Bézier curve by a polygon. ✨ appendToPolygon() is tailored for cumulating points from a sequence of bezier curves like being created by a spline interpolation.

Parameters:

  • p1 — Start point.
  • cp1 — First control point.
  • cp2 — Second control point.
  • p2 — End point.
  • polygon — Polygon, where the interpolating points are added.
Note: If the last point of the incoming polygon matches p1 it won't be inserted a second time. 🙈

Definition at line 186 of file qwt_bezier.cpp.

QPointF QwtBezier::pointAt (const QPointF & p1, const QPointF & cp1, const QPointF & cp2, const QPointF & p2, double t) [static]

Find a point on a Bézier Curve. 🔍

Parameters:

  • p1 — Start point.
  • cp1 — First control point.
  • cp2 — Second control point.
  • p2 — End point.
  • t — Parameter value, something between [0,1].

Returns: Point on the curve. 🎯

Definition at line 239 of file qwt_bezier.cpp.

void QwtBezier::setTolerance (double tolerance)

Set the tolerance. 🎚️

The tolerance is a measurement for the flatness of a curve. A curve with a flatness below the tolerance is considered as being flat terminating the subdivision algorithm.

When interpolating a Bezier curve to render it as a sequence of lines to some sort of raster ( f.e to screen ) a value of 0.5 of the pixel size is a good value for the tolerance.

Parameters:

  • tolerance — Termination criterion for the subdivision.

See also: tolerance()

Definition at line 141 of file qwt_bezier.cpp.

double QwtBezier::tolerance () const [inline]

Returns: Tolerance, that is used as criterion for the subdivision. 📏

See also: setTolerance()

Definition at line 56 of file qwt_bezier.h.

QPolygonF QwtBezier::toPolygon (const QPointF & p1, const QPointF & cp1, const QPointF & cp2, const QPointF & p2) const

Interpolate a Bézier curve by a polygon. ✨

Parameters:

  • p1 — Start point.
  • cp1 — First control point.
  • cp2 — Second control point.
  • p2 — End point.

Returns: Interpolating polygon. 🔷

Definition at line 157 of file qwt_bezier.cpp.

⭐ Author ⭐

Generated automatically by Doxygen for Qwt User's Guide from the source code. 🤖💖


✨ Okay bestie, that's the whole page! Footer business: this is from the Qwt User's Guide, it's QwtBezier(3), and there's no separate date printed — so I'm not inventing one. Periodt. 💅🎀

📦 where this page comes from