Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
path-boolop.cpp File Reference

Boolean operations. More...

Go to the source code of this file.

Functions

static Shape make_shape (Path &path, int path_id=-1, FillRule fill_rule=fill_nonZero, bool close_if_needed=true)
 Create a flattened shape from a path.
 
static Path make_path (Geom::PathVector const &pathv, std::vector< Geom::PathVectorTime > const &cuts)
 Create a path with backdata from a pathvector, automatically estimating a suitable conversion threshold.
 
static bool is_line (Path const &path)
 Return whether a path is a single open line segment.
 
static void distribute_intersection_times (std::vector< Geom::PathVectorTime > &dst1, std::vector< Geom::PathVectorTime > &dst2, std::vector< Geom::PathVectorIntersection > const &intersections)
 
static void sort_and_clean_intersection_times (std::vector< Geom::PathVectorTime > &vec)
 
Geom::PathVector flattened (Geom::PathVector const &pathv, FillRule fill_rule)
 Flatten a pathvector according to the given fill rule.
 
void flatten (Geom::PathVector &pathv, FillRule fill_rule)
 
std::vector< Geom::PathVectorpathvector_cut (Geom::PathVector const &pathv, Geom::PathVector const &lines)
 Cut a pathvector along a collection of lines into several smaller pathvectors.
 
Geom::PathVector sp_pathvector_boolop (Geom::PathVector const &pathva, Geom::PathVector const &pathvb, BooleanOp bop, FillRule fra, FillRule frb)
 Perform a boolean operation on two pathvectors.
 

Variables

constexpr auto RELATIVE_THRESHOLD = 0.08
 

Detailed Description

Boolean operations.

Definition in file path-boolop.cpp.

Function Documentation

◆ distribute_intersection_times()

static void distribute_intersection_times ( std::vector< Geom::PathVectorTime > &  dst1,
std::vector< Geom::PathVectorTime > &  dst2,
std::vector< Geom::PathVectorIntersection > const &  intersections 
)
inlinestatic

◆ flatten()

◆ flattened()

Geom::PathVector flattened ( Geom::PathVector const &  pathv,
FillRule  fill_rule 
)

Flatten a pathvector according to the given fill rule.

Definition at line 157 of file path-boolop.cpp.

References distribute_intersection_times(), Geom::PathVector::intersectSelf(), make_path(), make_shape(), Path::MakePathVector(), and sort_and_clean_intersection_times().

Referenced by flatten(), and Inkscape::SubItem::operator+=().

◆ is_line()

static bool is_line ( Path const &  path)
static

Return whether a path is a single open line segment.

Definition at line 119 of file path-boolop.cpp.

References Path::pts.

◆ make_path()

static Path make_path ( Geom::PathVector const &  pathv,
std::vector< Geom::PathVectorTime > const &  cuts 
)
static

Create a path with backdata from a pathvector, automatically estimating a suitable conversion threshold.

Definition at line 106 of file path-boolop.cpp.

References Path::LoadPathVector(), RELATIVE_THRESHOLD, and result.

Referenced by flattened(), pathvector_cut(), and sp_pathvector_boolop().

◆ make_shape()

static Shape make_shape ( Path path,
int  path_id = -1,
FillRule  fill_rule = fill_nonZero,
bool  close_if_needed = true 
)
static

Create a flattened shape from a path.

Parameters
pathThe path to convert.
path_idThe id to assign to all the edges in the resultant shape.
fill_ruleThe fill rule with which to flatten the path.
close_if_neededIf the path is not closed, whether to add a closing segment.

Definition at line 89 of file path-boolop.cpp.

References Path::Fill(), and result.

Referenced by flattened(), pathvector_cut(), and sp_pathvector_boolop().

◆ pathvector_cut()

◆ sort_and_clean_intersection_times()

static void sort_and_clean_intersection_times ( std::vector< Geom::PathVectorTime > &  vec)
static

◆ sp_pathvector_boolop()

Geom::PathVector sp_pathvector_boolop ( Geom::PathVector const &  pathva,
Geom::PathVector const &  pathvb,
BooleanOp  bop,
FillRule  fra,
FillRule  frb 
)

Variable Documentation

◆ RELATIVE_THRESHOLD

constexpr auto RELATIVE_THRESHOLD = 0.08
constexpr

Definition at line 100 of file path-boolop.cpp.

Referenced by Inkscape::ObjectSet::_pathBoolOp(), and make_path().