Inkscape
Vector Graphics Editor
|
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. | |
|
inline |
Definition at line 93 of file geom.h.
References Geom::Point::x(), and Geom::Point::y().
Referenced by Inkscape::Shortcuts::init(), Inkscape::LivePathEffect::GroupBBoxEffect::original_bbox(), and Inkscape::UI::Widget::ScalarUnit::setFromPercentage().
bool approx_dihedral | ( | Geom::Affine const & | affine, |
double | eps | ||
) |
Geom::OptRect bounds_exact_transformed | ( | Geom::PathVector const & | pv, |
Geom::Affine const & | t | ||
) |
Definition at line 153 of file geom.cpp.
References Geom::PathVector::empty(), Geom::PathVector::front(), and Geom::Path::initialPoint().
Referenced by Inkscape::CanvasItemBpath::_update(), Inkscape::DrawingShape::_updateItem(), SPHatchPath::bounds(), bounds_fast_transformed(), and SPShape::either_bbox().
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().
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().
Geom::OptRect check_simple_rect | ( | Geom::PathVector const & | pathv, |
double | precision = Geom::EPSILON |
||
) |
Definition at line 198 of file geom.cpp.
References Geom::are_near(), end, Geom::PathVector::front(), Geom::Path::initialPoint(), Geom::PathVector::size(), start, Geom::Point::x(), and Geom::Point::y().
Referenced by pathv_fully_contains().
size_t count_path_curves | ( | Geom::Path const & | path | ) |
Definition at line 821 of file geom.cpp.
References Geom::Path::back_closed(), Geom::Path::closed(), Geom::Path::empty(), and Geom::Path::size_default().
Referenced by count_pathvector_curves(), Inkscape::LivePathEffect::LPEFilletChamfer::doBeforeEffect(), Inkscape::LivePathEffect::LPEFilletChamfer::doEffect_path(), and PathVectorNodeSatellites::recalculateForNewPathVector().
size_t count_path_degenerations | ( | Geom::Path const & | path | ) |
Definition at line 764 of file geom.cpp.
References Geom::are_near(), Geom::Path::back_closed(), Geom::Path::begin(), Geom::Path::closed(), Geom::Path::empty(), Geom::Path::end_default(), and Geom::Path::end_open().
Referenced by count_pathvector_degenerations().
size_t count_path_nodes | ( | Geom::Path const & | path | ) |
Definition at line 796 of file geom.cpp.
References Geom::Path::back_closed(), Geom::Path::closed(), Geom::Path::empty(), and Geom::Path::size_default().
Referenced by PathVectorNodeSatellites::convertUnit(), count_pathvector_nodes(), Inkscape::LivePathEffect::FilletChamferKnotHolderEntity::knot_click(), Inkscape::LivePathEffect::FilletChamferKnotHolderEntity::knot_get(), Inkscape::LivePathEffect::FilletChamferKnotHolderEntity::knot_set(), Inkscape::LivePathEffect::FilletChamferKnotHolderEntity::knot_set_offset(), Inkscape::LivePathEffect::LPETransform2Pts::nodeCount(), PathVectorNodeSatellites::recalculateForNewPathVector(), PathVectorNodeSatellites::updateAmount(), Inkscape::LivePathEffect::NodeSatelliteArrayParam::updateCanvasIndicators(), and PathVectorNodeSatellites::updateNodeSatelliteType().
size_t count_pathvector_curves | ( | Geom::PathVector const & | pathv | ) |
Definition at line 747 of file geom.cpp.
References count_path_curves().
Referenced by Inkscape::LivePathEffect::Effect::doBeforeEffect_impl(), Inkscape::LivePathEffect::LPEPowerStroke::doEffect_path(), Inkscape::LivePathEffect::LPEPowerStroke::doOnApply(), Inkscape::LivePathEffect::PowerStrokePointArrayParamKnotHolderEntity::knot_set(), and Inkscape::LivePathEffect::sp_calculate_origin().
size_t count_pathvector_degenerations | ( | Geom::PathVector const & | pathv | ) |
Definition at line 756 of file geom.cpp.
References count_path_degenerations().
size_t count_pathvector_nodes | ( | Geom::PathVector const & | pathv | ) |
Definition at line 738 of file geom.cpp.
References count_path_nodes().
|
inline |
Definition at line 67 of file geom.h.
References Geom::GenericRect< C >::expandBy().
Referenced by Inkscape::CanvasItemGridXY::_render(), Inkscape::CanvasItemGridTiles::_render(), Inkscape::CanvasItemBpath::_update(), Inkscape::CanvasItemCurve::_update(), Inkscape::CanvasItemDrawing::_update(), Inkscape::CanvasItemQuad::_update(), Inkscape::UI::Widget::Stores::centered(), expandedBy(), Inkscape::UI::Widget::shrink_region(), Inkscape::UI::Widget::Stores::snapshot_combine(), Geom::TEST(), and Inkscape::UI::Widget::Stores::update().
|
inline |
Definition at line 79 of file geom.h.
References expandedBy().
|
inline |
Definition at line 73 of file geom.h.
References Geom::GenericRect< C >::expandBy().
|
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().
|
inline |
Definition at line 108 of file geom.h.
References Geom::IntPoint::x(), and Geom::IntPoint::y().
|
inline |
Definition at line 113 of file geom.h.
References Geom::Point::x(), and Geom::Point::y().
|
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().
|
inline |
Definition at line 98 of file geom.h.
References Geom::IntPoint::x(), and Geom::IntPoint::y().
|
inline |
Definition at line 103 of file geom.h.
References Geom::Point::x(), and Geom::Point::y().
|
inline |
Definition at line 88 of file geom.h.
References Geom::Point::x(), and Geom::Point::y().
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().
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 | ||
) |
Definition at line 465 of file geom.cpp.
References Geom::PathVector::empty(), Geom::GenericRect< C >::expandTo(), geom_curve_bbox_wind_distance(), geom_line_wind_distance(), and Geom::infinity().
Referenced by Inkscape::DrawingShape::_pickItem().
bool pathv_similar | ( | Geom::PathVector const & | apv, |
Geom::PathVector const & | bpv, | ||
double | precission = 0.001 |
||
) |
Definition at line 176 of file geom.cpp.
References Geom::are_near(), Geom::PathVector::curveCount(), and Geom::PathVector::pointAt().
Referenced by SPCurve::is_similar().
Geom::PathVector pathv_to_cubicbezier | ( | Geom::PathVector const & | pathv, |
bool | nolines | ||
) |
Definition at line 690 of file geom.cpp.
References Geom::Path::append(), Geom::Path::appendNew(), Geom::are_near(), Geom::PathVector::back(), Geom::Path::begin(), Geom::Path::close(), Geom::cubicbezierpath_from_sbasis(), Geom::Path::end_open(), Geom::Path::initialPoint(), is_straight_curve(), Geom::PathVector::push_back(), and Geom::Path::start().
Referenced by Inkscape::UI::PathManipulator::_createControlPointsFromGeometry(), and Inkscape::LivePathEffect::LPELattice2::doEffect_pwd2().
Geom::PathVector pathv_to_linear | ( | Geom::PathVector const & | pathv, |
double | maxdisp | ||
) |
Definition at line 634 of file geom.cpp.
References Geom::Path::append(), Geom::PathVector::back(), Geom::Path::close(), D, is_straight_curve(), pathv_to_linear_and_cubic_beziers(), Geom::PathVector::push_back(), recursive_bezier4(), and Geom::Path::start().
Referenced by Inkscape::Extension::Internal::PrintWmf::print_pathv(), and Inkscape::Extension::Internal::PrintWmf::print_simple_shape().
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().
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().
bool pointInTriangle | ( | Geom::Point const & | p, |
Geom::Point const & | p1, | ||
Geom::Point const & | p2, | ||
Geom::Point const & | p3 | ||
) |
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().
|
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().
|
inline |
|
inline |