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

Specific geometry functions for Inkscape, not provided my lib2geom. More...

Go to the source code of this file.

Functions

Geom::OptRect bounds_fast_transformed (Geom::PathVector const &pv, Geom::Affine const &t)
 
Geom::OptRect bounds_exact_transformed (Geom::PathVector const &pv, Geom::Affine const &t)
 
void pathv_matrix_point_bbox_wind_distance (Geom::PathVector const &pathv, Geom::Affine const &m, Geom::Point const &pt, Geom::Rect *bbox, int *wind, Geom::Coord *dist, Geom::Coord tolerance, Geom::Rect const *viewbox)
 
bool pathvs_have_nonempty_overlap (Geom::PathVector const &a, Geom::PathVector const &b)
 An exact check for whether the two pathvectors intersect or overlap, including the case of a line crossing through a solid shape.
 
bool pathv_fully_contains (Geom::PathVector const &a, Geom::PathVector const &b, FillRule fill_rule, double precision=Geom::EPSILON)
 Checks whether the filled region defined by pathvector a and fill rule fill_rule completely contains pathvector b.
 
size_t count_pathvector_nodes (Geom::PathVector const &pathv)
 
size_t count_path_nodes (Geom::Path const &path)
 
size_t count_pathvector_curves (Geom::PathVector const &pathv)
 
size_t count_path_curves (Geom::Path const &path)
 
size_t count_pathvector_degenerations (Geom::PathVector const &pathv)
 
size_t count_path_degenerations (Geom::Path const &path)
 
bool pointInTriangle (Geom::Point const &p, Geom::Point const &p1, Geom::Point const &p2, Geom::Point const &p3)
 
Geom::PathVector pathv_to_linear_and_cubic_beziers (Geom::PathVector const &pathv)
 
Geom::PathVector pathv_to_linear (Geom::PathVector const &pathv, double maxdisp)
 
Geom::PathVector pathv_to_cubicbezier (Geom::PathVector const &pathv, bool nolines)
 
bool pathv_similar (Geom::PathVector const &apv, Geom::PathVector const &bpv, double precission=0.001)
 
Geom::OptRect check_simple_rect (Geom::PathVector const &pathv, double precision=Geom::EPSILON)
 
void recursive_bezier4 (const double x1, const double y1, const double x2, const double y2, const double x3, const double y3, const double x4, const double y4, std::vector< Geom::Point > &pointlist, int level)
 
bool approx_dihedral (Geom::Affine const &affine, double eps=0.0001)
 Returns whether an affine transformation is approximately a dihedral transformation, i.e.
 
Geom::Coord triangle_area (Geom::Point const &p1, Geom::Point const &p2, Geom::Point const &p3)
 Returns signed area of triangle given by points; may be negative.
 
auto round_down (Geom::IntPoint const &a, Geom::IntPoint const &b)
 
auto expandedBy (Geom::IntRect rect, int amount)
 
auto expandedBy (Geom::Rect rect, double amount)
 
Geom::OptRect expandedBy (Geom::OptRect const &rect, double amount)
 
auto operator/ (double a, Geom::Point const &b)
 
auto absolute (Geom::Point const &a)
 
auto min (Geom::IntPoint const &a)
 
auto min (Geom::Point const &a)
 
auto max (Geom::IntPoint const &a)
 
auto max (Geom::Point const &a)
 
template<typename... Args>
auto bounds_of (Geom::Point const &pt, Args const &... args)
 Get the bounding box of a collection of points.
 
auto floor (Geom::Rect const &rect)
 
auto roundedOutwards (Geom::OptRect const &rect)
 
double max_expansion (Geom::Affine const &affine)
 Compute the maximum factor by which affine can increase a vector's length.
 

Detailed Description

Specific geometry functions for Inkscape, not provided my lib2geom.

Definition in file geom.h.

Function Documentation

◆ absolute()

◆ approx_dihedral()

bool approx_dihedral ( Geom::Affine const &  affine,
double  eps 
)

Returns whether an affine transformation is approximately a dihedral transformation, i.e.

it maps the axis-aligned unit square centred at the origin to itself.

Definition at line 1097 of file geom.cpp.

◆ bounds_exact_transformed()

◆ bounds_fast_transformed()

Geom::OptRect bounds_fast_transformed ( Geom::PathVector const &  pv,
Geom::Affine const &  t 
)

Definition at line 147 of file geom.cpp.

References bounds_exact_transformed().

◆ bounds_of()

template<typename... Args>
auto bounds_of ( Geom::Point const &  pt,
Args const &...  args 
)

Get the bounding box of a collection of points.

Definition at line 120 of file geom.h.

References bounds_of().

Referenced by Inkscape::CanvasItemQuad::_update(), and bounds_of().

◆ check_simple_rect()

Geom::OptRect check_simple_rect ( Geom::PathVector const &  pathv,
double  precision = Geom::EPSILON 
)

◆ count_path_curves()

◆ count_path_degenerations()

◆ count_path_nodes()

◆ count_pathvector_curves()

◆ count_pathvector_degenerations()

size_t count_pathvector_degenerations ( Geom::PathVector const &  pathv)

Definition at line 756 of file geom.cpp.

References count_path_degenerations().

◆ count_pathvector_nodes()

size_t count_pathvector_nodes ( Geom::PathVector const &  pathv)

Definition at line 738 of file geom.cpp.

References count_path_nodes().

◆ expandedBy() [1/3]

◆ expandedBy() [2/3]

Geom::OptRect expandedBy ( Geom::OptRect const &  rect,
double  amount 
)
inline

Definition at line 79 of file geom.h.

References expandedBy().

◆ expandedBy() [3/3]

auto expandedBy ( Geom::Rect  rect,
double  amount 
)
inline

Definition at line 73 of file geom.h.

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

◆ floor()

auto floor ( Geom::Rect const &  rect)
inline

Definition at line 131 of file geom.h.

References Geom::GenericRect< C >::max(), and Geom::GenericRect< C >::min().

Referenced by SPHatchPath::_calculateRenderCurve(), SPHatch::_calculateRenderInfo(), Inkscape::Extension::Internal::CairoRenderContext::_createHatchPainter(), Inkscape::DrawingImage::_pickItem(), Inkscape::CanvasItemGridXY::_render(), Inkscape::CanvasItemGridTiles::_render(), Inkscape::CanvasItemGridAxonom::_render(), Inkscape::CanvasItemRect::_render(), Inkscape::UI::Widget::CanvasGrid::_rulerMotion(), Inkscape::CanvasItemText::_update(), Inkscape::UI::Dialog::add_shadow(), SurfaceSynth::alphaAt(), Inkscape::SVG::PathString::State::appendRelativeCoord(), Inkscape::UI::Dialog::SingleExport::areaXChange(), Inkscape::UI::Dialog::SingleExport::areaYChange(), convertHSVtoRGB(), Inkscape::LivePathEffect::LPECopyRotate::doBeforeEffect(), Inkscape::LivePathEffect::LPEPatternAlongPath::doEffect_pwd2(), Inkscape::UI::Dialog::SingleExport::dpiChange(), cola::GradientProjection::dumpSquareMatrix(), Inkscape::Trace::Potrace::PotraceTracingEngine::filter(), Inkscape::UI::Tools::fit_item(), InkFileExportCmd::get_bgcolor(), Spiro::mod_2pi(), Inkscape::Extension::Internal::PdfImportDialog::PdfImportDialog(), SurfaceSynth::pixelAt(), point_unique_int(), pow_sample_based(), Geom::reciprocalOnDomain(), Inkscape::SelTrans::rotateRequest(), Geom::Interval::roundInwards(), Geom::Interval::roundOutwards(), Inkscape::SelTrans::skewRequest(), Inkscape::snap_rectangular_box(), sp_svg_number_write_d(), sp_svg_number_write_de(), Inkscape::UI::Tools::tweak_colors_in_gradient(), Inkscape::UI::Dialog::CloneTiler::xy_changed(), and Inkscape::UI::Widget::StatusBar::zoom_output().

◆ max() [1/2]

auto max ( Geom::IntPoint const &  a)
inline

Definition at line 108 of file geom.h.

References Geom::IntPoint::x(), and Geom::IntPoint::y().

◆ max() [2/2]

auto max ( Geom::Point const &  a)
inline

Definition at line 113 of file geom.h.

References Geom::Point::x(), and Geom::Point::y().

◆ max_expansion()

double max_expansion ( Geom::Affine const &  affine)
inline

Compute the maximum factor by which affine can increase a vector's length.

Definition at line 144 of file geom.h.

References Geom::Affine::det(), and Geom::sqr().

Referenced by Inkscape::DrawingShape::_pickItem(), and Inkscape::DrawingShape::_updateItem().

◆ min() [1/2]

auto min ( Geom::IntPoint const &  a)
inline

Definition at line 98 of file geom.h.

References Geom::IntPoint::x(), and Geom::IntPoint::y().

◆ min() [2/2]

auto min ( Geom::Point const &  a)
inline

Definition at line 103 of file geom.h.

References Geom::Point::x(), and Geom::Point::y().

◆ operator/()

auto operator/ ( double  a,
Geom::Point const &  b 
)
inline

Definition at line 88 of file geom.h.

References Geom::Point::x(), and Geom::Point::y().

◆ pathv_fully_contains()

bool pathv_fully_contains ( Geom::PathVector const &  a,
Geom::PathVector const &  b,
FillRule  fill_rule,
double  precision = Geom::EPSILON 
)

Checks whether the filled region defined by pathvector a and fill rule fill_rule completely contains pathvector b.

Definition at line 551 of file geom.cpp.

References Geom::PathVector::boundsExact(), check_simple_rect(), Geom::GenericOptRect< C >::contains(), Geom::PathVector::intersect(), is_point_inside(), and Geom::PathVector::winding().

Referenced by Inkscape::Extension::Internal::SvgBuilder::_shouldClip().

◆ pathv_matrix_point_bbox_wind_distance()

void pathv_matrix_point_bbox_wind_distance ( Geom::PathVector const &  pathv,
Geom::Affine const &  m,
Geom::Point const &  pt,
Geom::Rect bbox,
int *  wind,
Geom::Coord dist,
Geom::Coord  tolerance,
Geom::Rect const *  viewbox 
)

◆ pathv_similar()

bool pathv_similar ( Geom::PathVector const &  apv,
Geom::PathVector const &  bpv,
double  precission = 0.001 
)

◆ pathv_to_cubicbezier()

◆ pathv_to_linear()

◆ pathv_to_linear_and_cubic_beziers()

Geom::PathVector pathv_to_linear_and_cubic_beziers ( Geom::PathVector const &  pathv)

Definition at line 586 of file geom.cpp.

References Geom::Path::append(), Geom::PathVector::back(), Geom::Path::close(), Geom::cubicbezierpath_from_sbasis(), is_straight_curve(), Geom::PathVector::push_back(), Geom::Path::setStitching(), Geom::Path::start(), and Geom::Exception::what().

Referenced by Inkscape::UI::PathManipulator::_createControlPointsFromGeometry(), Inkscape::LivePathEffect::collectPathsAndWidths(), Inkscape::do_offset(), Inkscape::LivePathEffect::LPEFilletChamfer::doBeforeEffect(), Inkscape::LivePathEffect::LPEMeasureSegments::doBeforeEffect(), Inkscape::LivePathEffect::LPETaperStroke::doBeforeEffect(), Inkscape::Extension::Internal::PovOutput::doCurve(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::doEffect(), Inkscape::LivePathEffect::LPERoughen::doEffect(), Inkscape::LivePathEffect::LPESimplify::doEffect(), Inkscape::LivePathEffect::LPEKnot::doEffect_path(), Inkscape::LivePathEffect::LPECopyRotate::doEffect_path(), Inkscape::LivePathEffect::LPEDashedStroke::doEffect_path(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doEffect_path(), Inkscape::LivePathEffect::LPEPowerStroke::doEffect_path(), Inkscape::LivePathEffect::LPEShowHandles::doEffect_path(), Inkscape::LivePathEffect::LPECopyRotate::doEffect_path_post(), Inkscape::LivePathEffect::LPETiling::doEffect_path_post(), Inkscape::LivePathEffect::LPEFilletChamfer::doOnApply(), Inkscape::LivePathEffect::LPEPowerStroke::doOnApply(), Inkscape::Extension::Internal::PrintEmf::draw_pathv_to_EMF(), item_find_paths(), pathv_to_linear(), Inkscape::Extension::Internal::PrintEmf::pathv_to_simple_polygon(), Inkscape::Extension::Internal::PrintEmf::print_simple_shape(), Inkscape::UI::Tools::MeasureTool::showCanvasItems(), Inkscape::LivePathEffect::sp_pathvector_boolop_remove_inner(), Inkscape::LivePathEffect::sp_pathvector_boolop_slice_intersect(), Inkscape::LivePathEffect::LPESlice::splititem(), and Inkscape::Extension::Internal::writePath().

◆ pathvs_have_nonempty_overlap()

bool pathvs_have_nonempty_overlap ( Geom::PathVector const &  a,
Geom::PathVector const &  b 
)

An exact check for whether the two pathvectors intersect or overlap, including the case of a line crossing through a solid shape.

Definition at line 513 of file geom.cpp.

References Geom::PathVector::boundsFast(), Geom::SimpleCrosser::crossings(), node, Geom::PathVector::nodes(), and Geom::PathVector::winding().

Referenced by SPItem::collidesWith().

◆ pointInTriangle()

bool pointInTriangle ( Geom::Point const &  p,
Geom::Point const &  p1,
Geom::Point const &  p2,
Geom::Point const &  p3 
)

Definition at line 446 of file geom.cpp.

References Geom::X, and Geom::Y.

◆ recursive_bezier4()

void recursive_bezier4 ( const double  x1,
const double  y1,
const double  x2,
const double  y2,
const double  x3,
const double  y3,
const double  x4,
const double  y4,
std::vector< Geom::Point > &  pointlist,
int  level 
)

Definition at line 869 of file geom.cpp.

References recursive_bezier4().

Referenced by pathv_to_linear(), and recursive_bezier4().

◆ round_down()

auto round_down ( Geom::IntPoint const &  a,
Geom::IntPoint const &  b 
)
inline

Definition at line 61 of file geom.h.

References round_down(), Geom::IntPoint::x(), and Geom::IntPoint::y().

Referenced by Inkscape::DrawingPattern::renderPattern(), and round_down().

◆ roundedOutwards()

auto roundedOutwards ( Geom::OptRect const &  rect)
inline

Definition at line 136 of file geom.h.

◆ triangle_area()

Geom::Coord triangle_area ( Geom::Point const &  p1,
Geom::Point const &  p2,
Geom::Point const &  p3 
)
inline

Returns signed area of triangle given by points; may be negative.

Definition at line 54 of file geom.h.

References Geom::X, and Geom::Y.