16 if(ch.
empty())
return;
24 if(!cairo_has_current_point(cr))
28 cairo_line_to(cr, (*line_segment)[1][0], (*line_segment)[1][1]);
31 std::vector<Point> points = quadratic_bezier->controlPoints();
32 Point b1 = points[0] + (2./3) * (points[1] - points[0]);
33 Point b2 = b1 + (1./3) * (points[2] - points[0]);
36 points[2][0], points[2][1]);
39 std::vector<Point> points = cubic_bezier->controlPoints();
40 cairo_curve_to(cr, points[1][0], points[1][1], points[2][0], points[2][1], points[3][0], points[3][1]);
50 for(
const auto & iter : sbasis_path) {
66 for(
const auto & iter : p) {
75 for ( iter = p.
begin() ; iter != p.
end() ; ++iter ) {
82 s <<
L1(
c.finalPoint() -
c.initialPoint());
83 std::string ss = s.str();
84 draw_text(cr,
c.initialPoint()+
Point(5,5), ss.c_str(),
false,
"Serif 6");
97 for(it = p.
begin(); it != p.
end(); ++it) {
104 for ( it = p.
begin() ; it != p.
end() ; ++it ) {
115 for(
int ui = 0; ui <= 10; ui++) {
119 for(
unsigned i = 0; i < 2; i ++) {
124 for(
int vi = 0; vi <= 10; vi++) {
128 for(
unsigned i = 0; i < 2; i ++) {
137 for(
int ui = 0; ui <= 10; ui++) {
141 for(
unsigned i = 0; i < 2; i ++) {
146 for(
int vi = 0; vi <= 10; vi++) {
150 for(
unsigned i = 0; i < 2; i ++) {
162 for(
unsigned i = 0; i < p.size(); i++)
198 cairo_new_sub_path(cr);
199 cairo_arc(cr, x, y, 3, 0, M_PI*2);
241 double&
R,
double& G,
double& B) {
242 int Hi = int(
floor(H/60.)) % 6;
243 double f = H/60. - Hi;
245 double q = V*(1-f*S);
246 double t = V*(1-(1-f)*S);
248 case 0:
R=V, G=t, B=p;
break;
249 case 1:
R=q, G=V, B=p;
break;
250 case 2:
R=p, G=V, B=t;
break;
251 case 3:
R=p, G=q, B=V;
break;
252 case 4:
R=t, G=p, B=V;
break;
253 case 5:
R=V, G=p, B=q;
break;
259 std::optional<Geom::LineSegment> seg = l.
clip(r);
271 draw_line (cr, coeff[0], coeff[1], coeff[2], r);
284 for (
size_t i = 0; i < 4; ++i)
318 double angle =
atan2(a-b);
Various utility functions.
void setInitial(Point const &v) override
Change the starting point of the curve.
void setFinal(Point const &v) override
Change the ending point of the curve.
Convex hull based on the Andrew's monotone chain algorithm.
bool empty() const
Check for emptiness.
size_t size() const
Get the number of points in the hull.
Abstract continuous curve on a plane defined on [0,1].
Adaptor that creates 2D functions from 1D ones.
bool contains(GenericRect< C > const &r) const
Check whether the rectangle includes all points in the given rectangle.
C top() const
Return top coordinate of the rectangle (+Y is downwards).
C left() const
Return leftmost coordinate of the rectangle (+X is to the right).
C height() const
Get the vertical extent of the rectangle.
C width() const
Get the horizontal extent of the rectangle.
CPoint corner(unsigned i) const
Return the n-th corner of the rectangle.
Infinite line on a plane.
std::vector< double > coefficients() const
Get the coefficients of the line equation as a vector.
std::optional< LineSegment > clip(Rect const &r) const
Return the portion of the line that is inside the given rectangle.
Function that interpolates linearly between two values.
Sequence::const_iterator const_iterator
Sequence of contiguous curves, aka spline.
bool closed() const
Check whether the path is closed.
Point finalPoint() const
Get the last point in the path.
const_iterator end() const
Point initialPoint() const
Get the first point in the path.
size_type size() const
Natural size of the path.
const_iterator begin() const
Function defined as discrete pieces.
Two-dimensional point that doubles as a vector.
Straight ray from a specific point to infinity.
Point pointAt(Coord t) const
Axis aligned, non-empty rectangle.
Polynomial in symmetric power basis.
auto floor(Geom::Rect const &rect)
Various utility functions.
Path path_from_sbasis(D2< SBasis > const &B, double tol, bool only_cubicbeziers=false)
Make a path from a d2 sbasis.
Linear extract_v(Linear2d const &a, double v)
std::optional< Crossing > OptCrossing
double atan2(Point const &p)
OptCrossing intersection(Ray const &r1, Line const &l2)
Piecewise< D2< SBasis > > sectionize(D2< Piecewise< SBasis > > const &a)
Path cubicbezierpath_from_sbasis(D2< SBasis > const &B, double tol)
Linear extract_u(Linear2d const &a, double u)
Point unit_vector(Point const &a)
D2< T > rot90(D2< T > const &a)
void draw_line_seg_with_arrow(cairo_t *cr, Geom::Point a, Geom::Point b, double dangle, double radius)
void draw_spot(cairo_t *cr, Geom::Point h)
void cairo_curve(cairo_t *cr, Curve const &c)
void cairo_line_to(cairo_t *cr, Geom::Point p1)
void cairo_path_stitches(cairo_t *cr, Path const &p)
void draw_cross(cairo_t *cr, Geom::Point h)
void draw_line_segment(cairo_t *cr, const Geom::LineSegment &ls, const Geom::Rect &r)
void draw_line(cairo_t *cr, double a, double b, double c, const Geom::Rect &r)
void cairo_d2_pw_sb(cairo_t *cr, D2< Piecewise< SBasis > > const &p)
void cairo_pw_d2_sb(cairo_t *cr, Piecewise< D2< SBasis > > const &p)
void draw_ray(cairo_t *cr, Geom::Point h, Geom::Point dir)
void draw_circ(cairo_t *cr, Geom::Point h)
void cairo_path_handles(cairo_t *, Path const &)
void cairo_sb2d(cairo_t *cr, SBasis2d const &sb2, Point dir, double width)
void draw_handle(cairo_t *cr, Geom::Point h)
void cairo_path(cairo_t *cr, Path const &p)
void cairo_d2_sb2d(cairo_t *cr, D2< SBasis2d > const &sb2, Point, double width)
void cairo_convex_hull(cairo_t *cr, ConvexHull const &ch)
void cairo_move_to(cairo_t *cr, Geom::Point p1)
void cairo_d2_sb(cairo_t *cr, D2< SBasis > const &B)
void cairo_rectangle(cairo_t *cr, Rect const &r)
void cairo_curve_to(cairo_t *cr, Geom::Point p1, Geom::Point p2, Geom::Point p3)
void convertHSVtoRGB(const double H, const double S, const double V, double &R, double &G, double &B)
void draw_line_seg(cairo_t *cr, Geom::Point a, Geom::Point b)
Conversion between SBasis and Bezier basis polynomials.
void draw_text(cairo_t *cr, Geom::Point pos, const char *txt, bool bottom=false, const char *fontdesc="Sans")