Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
curve.h File Reference

Go to the source code of this file.

Functions

bool is_closed (Geom::PathVector const &pathv)
 Whether all subpaths are closed. Returns false if the curve is empty.
 
size_t node_count (Geom::PathVector const &pathv)
 returns the number of nodes in a path, used for statusbar text when selecting an spcurve.
 
Geom::Curve const * get_last_segment (Geom::PathVector const &pathv)
 Return last pathsegment (possibly the closing path segment) of the last path in PathVector or null.
 
Geom::Curve const * get_last_segment (Geom::Path const &)=delete
 
Geom::Curve const * get_first_segment (Geom::PathVector const &pathv)
 Return first pathsegment in PathVector or NULL.
 
Geom::Curve const * get_first_segment (Geom::Path const &)=delete
 
void stretch_endpoints (Geom::PathVector &pathv, Geom::Point const &new_p0, Geom::Point const &new_p1)
 ?
 
void move_endpoints (Geom::PathVector &pathv, Geom::Point const &new_p0, Geom::Point const &new_p1)
 Sets start of first path to new_p0, and end of first path to new_p1.
 
void move_endpoints (Geom::Path &pathv, Geom::Point const &new_p0, Geom::Point const &new_p1)
 
void last_point_additive_move (Geom::PathVector &pathv, Geom::Point const &p)
 Add p to the last point (and last handle if present) of the last path.
 
void pathvector_append (Geom::PathVector &to, Geom::PathVector const &pathv, bool use_lineto=false)
 Append pathv to to.
 
bool pathvector_append_continuous (Geom::PathVector &to, Geom::PathVector const &pathv, double tolerance=0.0625)
 Append pathv to to with possible fusing of close endpoints.
 
Geom::Path rect_to_open_path (Geom::Rect const &rect)
 Construct an open path from a rectangle.
 
void closepath_current (Geom::Path &path)
 Close path by setting the end point to the start point instead of adding a new lineto.
 
void backspace (Geom::PathVector &pathv)
 Remove last segment of curve.
 
void backspace (Geom::Path &path)
 
template<typename T >
auto ptr_to_opt (T const &p)
 Create a std::optional<T> from a (generalised) pointer to T.
 
Geom::Path path_from_curve (std::unique_ptr< Geom::Curve > curve)
 Construct an open Geom::Path from Geom::Curve. Fixme: Should be in 2geom.
 
Geom::Path path_from_curve (Geom::Curve const &curve)
 

Function Documentation

◆ backspace() [1/2]

void backspace ( Geom::Path path)

Definition at line 147 of file curve.cpp.

References Geom::Path::close(), Geom::Path::empty(), and Geom::Path::erase_last().

◆ backspace() [2/2]

◆ closepath_current()

◆ get_first_segment() [1/2]

Geom::Curve const * get_first_segment ( Geom::Path const &  )
delete

◆ get_first_segment() [2/2]

Geom::Curve const * get_first_segment ( Geom::PathVector const &  pathv)

Return first pathsegment in PathVector or NULL.

equal in functionality to SPCurve::first_bpath()

Definition at line 70 of file curve.cpp.

References Geom::Path::empty(), Geom::PathVector::empty(), Geom::PathVector::front(), and Geom::Path::front().

Referenced by Inkscape::UI::Tools::PenTool::_bsplineSpiroOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroOn(), and Inkscape::LivePathEffect::LPERoughen::doEffect().

◆ get_last_segment() [1/2]

Geom::Curve const * get_last_segment ( Geom::Path const &  )
delete

◆ get_last_segment() [2/2]

◆ is_closed()

◆ last_point_additive_move()

void last_point_additive_move ( Geom::PathVector pathv,
Geom::Point const &  p 
)

◆ move_endpoints() [1/2]

void move_endpoints ( Geom::Path pathv,
Geom::Point const &  new_p0,
Geom::Point const &  new_p1 
)

Definition at line 195 of file curve.cpp.

References Geom::Path::setFinal(), and Geom::Path::setInitial().

◆ move_endpoints() [2/2]

◆ node_count()

size_t node_count ( Geom::PathVector const &  pathv)

returns the number of nodes in a path, used for statusbar text when selecting an spcurve.

Sum of nodes in all the paths. When a path is closed, and its closing line segment is of zero-length, this function will not count the closing knot double (so basically ignores the closing line segment when it has zero length)

Definition at line 201 of file curve.cpp.

References Geom::are_near().

Referenced by Inkscape::UI::Tools::PencilTool::_interpolate(), and SPPath::nodesInPath().

◆ path_from_curve() [1/2]

Geom::Path path_from_curve ( Geom::Curve const &  curve)

Definition at line 251 of file curve.cpp.

References path_from_curve().

◆ path_from_curve() [2/2]

◆ pathvector_append()

◆ pathvector_append_continuous()

bool pathvector_append_continuous ( Geom::PathVector to,
Geom::PathVector const &  pathv,
double  tolerance = 0.0625 
)

Append pathv to to with possible fusing of close endpoints.

If the end of to and the start of pathv are within tolerance distance, then the startpoint of pathv is moved to the end of to and the first subpath of pathv is appended to the last subpath of to. When one of the curves is empty, this curves path becomes the non-empty path.

Parameters
toleranceTolerance for endpoint fusion (applied to x and y separately)
Returns
false if one of the curves is closed, true otherwise.

Definition at line 104 of file curve.cpp.

References Geom::Path::append(), Geom::PathVector::back(), Geom::PathVector::begin(), Geom::PathVector::empty(), Geom::PathVector::end(), Geom::Path::finalPoint(), Geom::PathVector::finalPoint(), Geom::PathVector::initialPoint(), is_closed(), Geom::LInfty(), pathvector_append(), Geom::PathVector::push_back(), and Geom::Path::setInitial().

Referenced by Inkscape::UI::Tools::PenTool::_bsplineSpiroBuild(), Inkscape::UI::Tools::PenTool::_bsplineSpiroEndAnchorOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroEndAnchorOn(), Inkscape::UI::Tools::PenTool::_bsplineSpiroStartAnchorOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroStartAnchorOn(), SPHatchPath::_calculateRenderCurve(), Inkscape::UI::Tools::ConnectorTool::_finishSegment(), Inkscape::UI::Tools::PenTool::_finishSegment(), Inkscape::UI::Tools::PencilTool::_fitAndSplit(), Inkscape::UI::Tools::PenTool::_lastpointToCurve(), Inkscape::UI::Tools::PenTool::_lastpointToLine(), Inkscape::LivePathEffect::LPERoughen::doEffect(), and Inkscape::UI::Tools::spdc_concat_colors_and_flush().

◆ ptr_to_opt()

◆ rect_to_open_path()

Geom::Path rect_to_open_path ( Geom::Rect const &  rect)

Construct an open path from a rectangle.

That is, with the fourth side represented by a genuine line segment, rather than the closing segment.

Construct an open path from a rectangle.

Copyright (C) 2000 Lauris Kaplinski Copyright (C) 2000-2001 Ximian, Inc. Copyright (C) 2002 Lauris Kaplinski Copyright (C) 2008 Johan Engelen

Released under GNU GPL v2+, read the file 'COPYING' for more information.

Definition at line 22 of file curve.cpp.

References Geom::GenericRect< C >::corner().

Referenced by Inkscape::ObjectSnapper::_getPathvFromRect(), and sp_image_set_curve().

◆ stretch_endpoints()