31#include <boost/python.hpp>
32#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
45using namespace boost::python;
56 PyErr_SetString(PyExc_IndexError,
"index out of range");
57 boost::python::throw_error_already_set();
66 bool isDegenerate()
const {
return this->get_override(
"isDegenerate")();}
67 CurveWrap *
duplicate()
const {
return this->get_override(
"duplicate")();}
71 std::vector<double>
roots(
double v,
Geom::Dim2 d)
const {
return this->get_override(
"roots")(
v,d);}
74 if (
override f = this->get_override(
"winding")) {
81 Geom::Curve *
portion(
double f,
double t)
const {
return this->get_override(
"portion")(f,t); }
83 if (
override f = this->get_override(
"reverse")) {
96 if (
override f = this->get_override(
"pointAt")) {
103 return this->get_override(
"pointAndDerivatives")(t,
n);
190 class_<Geom::Path>(
"Path")
191 .def(
"__getitem__",
path_getitem, return_value_policy<copy_const_reference>())
221 class_<Geom::PathVector >(
"PathVector")
222 .def(vector_indexing_suite<Geom::PathVector >())
244 def(
"cairo_path",
cp_1);
245 def(
"cairo_path",
cp_2);
246 def(
"cairo_path_stitches",
cps_1);
247 def(
"cairo_path_stitches",
cps_2);
Path - a sequence of contiguous curves.
Cartesian point / 2D vector and related operations.
void py_cairo_curve(object cr, Geom::Curve const &c)
void(* cp_2)(object, Geom::PathVector const &)
Geom::Point(Geom::Path::* path_pointAt_time)(Geom::Coord) const
void py_cairo_path(object cr, Geom::Path const &p)
void py_cairo_d2_sb(object cr, Geom::D2< Geom::SBasis > const &p)
void(Geom::Path::* appendPortionTo_time)(Geom::Path &, Geom::Coord, Geom::Coord) const
void(* cps_2)(object, Geom::PathVector const &)
Geom::Curve const & path_getitem(Geom::Path const &p, int index)
void py_cairo_rectangle(object cr, Geom::Rect const &r)
void py_cairo_path_stitches(object cr, Geom::Path const &p)
void(* cps_1)(object, Geom::Path const &)
void(* cp_1)(object, Geom::Path const &)
void py_cairo_d2_pw_sb(object cr, Geom::D2< Geom::Piecewise< Geom::SBasis > > const &p)
void py_cairo_convex_hull(object cr, Geom::ConvexHull const &r)
void py_cairo_pw_d2_sb(object cr, Geom::Piecewise< Geom::D2< Geom::SBasis > > const &p)
Geom::Coord(Geom::Path::* path_valueAt_time)(Geom::Coord, Geom::Dim2) const
cairo_t * cairo_t_from_object(boost::python::object cr)
3x3 matrix representing an affine transformation.
Convex hull based on the Andrew's monotone chain algorithm.
Abstract continuous curve on a plane defined on [0,1].
virtual D2< SBasis > toSBasis() const =0
Convert the curve to a symmetric power basis polynomial.
virtual Point initialPoint() const =0
Retrieve the start of the curve.
virtual Point finalPoint() const =0
Retrieve the end of the curve.
virtual Rect boundsFast() const =0
Quickly compute the curve's approximate bounding box.
virtual Curve * reverse() const
Create a reversed version of this curve.
virtual Curve * transformed(Affine const &m) const
Create a curve transformed by an affine transformation.
virtual std::vector< Coord > roots(Coord v, Dim2 d) const =0
Computes time values at which the curve intersects an axis-aligned line.
virtual bool isDegenerate() const =0
Check whether the curve has exactly zero length.
virtual int winding(Point const &p) const
Compute the partial winding number of this curve.
virtual Rect boundsExact() const =0
Compute the curve's exact bounding box.
virtual Curve * derivative() const =0
Create a derivative of this curve.
virtual Curve * duplicate() const =0
Create an exact copy of this curve.
virtual Curve * portion(Coord a, Coord b) const =0
Create a curve that corresponds to a part of this curve.
virtual std::vector< Point > pointAndDerivatives(Coord t, unsigned n) const =0
Evaluate the curve and its derivatives.
virtual OptRect boundsLocal(OptInterval const &i, unsigned deg) const =0
virtual Point pointAt(Coord t) const
Evaluate the curve at a specified time value.
Adaptor that creates 2D functions from 1D ones.
Range of real numbers that can be empty.
Axis-aligned rectangle that can be empty.
OptRect boundsExact() const
OptRect boundsFast() const
PathVector reversed(bool reverse_paths=true) const
Get a new vector with reversed direction of paths.
void reverse(bool reverse_paths=true)
Reverse the direction of paths in the vector.
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.
void close(bool closed=true)
Set whether the path is closed.
bool empty() const
Check whether path is empty.
OptRect boundsExact() const
Get a tight-fitting bounding box.
Piecewise< D2< SBasis > > toPwSb() const
std::vector< PathTime > roots(Coord v, Dim2 d) const
Compute intersections with axis-aligned line.
OptRect boundsFast() const
Get the approximate bounding box.
void clear()
Remove all curves from the path.
size_type size_default() const
Natural size of the path.
Point initialPoint() const
Get the first point in the path.
Path reversed() const
Obtain a reversed version of the current path.
void start(Point const &p)
Function defined as discrete pieces.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
Path and its polyline approximation.
Lifts one dimensional objects into 2D.
Dim2
2D axis enumeration (X or Y).
double Coord
Floating point type used to store coordinates.
std::pair< size_t, size_t > deg(poly_vector_type const &p)
Various utility functions.
Path path_from_sbasis(D2< SBasis > const &B, double tol, bool only_cubicbeziers=false)
Make a path from a d2 sbasis.
Piecewise< D2< SBasis > > paths_to_pw(PathVector const &paths)
PathVector path_from_piecewise(Piecewise< D2< SBasis > > const &B, double tol, bool only_cubicbeziers=false)
Make a path from a d2 sbasis.
Path cubicbezierpath_from_sbasis(D2< SBasis > const &B, double tol)
void cairo_rectangle(cairo_t *cr, Geom::Rect const &r)
void cairo_line_to(cairo_t *cr, Geom::Point p1)
void cairo_path(cairo_t *cr, Geom::Path const &p)
void cairo_curve(cairo_t *cr, Geom::Curve const &c)
void cairo_d2_pw_sb(cairo_t *cr, Geom::D2< Geom::Piecewise< Geom::SBasis > > const &p)
void cairo_convex_hull(cairo_t *cr, Geom::ConvexHull const &r)
void cairo_move_to(cairo_t *cr, Geom::Point p1)
void cairo_d2_sb(cairo_t *cr, Geom::D2< Geom::SBasis > const &p)
void cairo_curve_to(cairo_t *cr, Geom::Point p1, Geom::Point p2, Geom::Point p3)
void cairo_pw_d2_sb(cairo_t *cr, Geom::Piecewise< Geom::D2< Geom::SBasis > > const &p)
void cairo_path_stitches(cairo_t *cr, Geom::Path const &p)
PathVector - a sequence of subpaths.
Conversion between SBasis and Bezier basis polynomials.