/*
5 * Authors: see git history
7 * Copyright (C) 2022 Authors
8 * Copyright (C) Johan Engelen 2006-2007 <johan@shouraizou.nl>
9 * Copyright (C) Lauris Kaplinski 2000
10 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
23 int step = std::max(major, 1);
26 while (length * multiply < 8.0 && watchdog < 100) {
85 default: g_assert_not_reached();
return {};
121 if (spacing.isZero())
continue;;
123 for (
int i = 0; i < 2; ++i) {
124 double scaled_spacing = spacing[i];
130 scaled_spacing *= mult;
152 std::swap(ta_x, ta_z);
155 double spacing_h = spacing.y() / (ta_x + ta_z);
156 double spacing_v = spacing.y();
215 bool use_left_half =
true;
216 bool use_right_half =
true;
221 use_right_half = !use_left_half;
232 if (use_right_half) {
static int calculate_scaling_factor(double length, int major)
Coord descrim() const
Calculate the descriminant.
Affine withoutTranslation() const
Infinite line on a plane.
Point pointAt(Coord t) const
Two-dimensional point that doubles as a vector.
constexpr Coord y() const noexcept
constexpr Coord x() const noexcept
LineList get_snap_lines(const Geom::Point &p, int limit) const
bool getSnapperAlwaysSnap(SnapSourceType const &source) const override
void _addSnappedLinePerpendicularly(IntermSnapResults &isr, Geom::Point const &snapped_point, Geom::Coord const &snapped_distance, SnapSourceType const &source, long source_num, bool constrained_snap) const override
LineList _getSnapLines(Geom::Point const &p) const override
bool ThisSnapperMightSnap() const override
GridSnapper(SPGrid const *grid, SnapManager *sm, Geom::Coord const d)
void _addSnappedPoint(IntermSnapResults &isr, Geom::Point const &snapped_point, Geom::Coord const &snapped_distance, SnapSourceType const &source, long source_num, bool constrained_snap) const override
Geom::Coord getSnapperTolerance() const override
void _addSnappedLine(IntermSnapResults &isr, Geom::Point const &snapped_point, Geom::Coord const &snapped_distance, SnapSourceType const &source, long source_num, Geom::Point const &normal_to_line, const Geom::Point &point_on_line) const override
LineList getSnapLinesAxonom(Geom::Point const &p) const
Superclass for snappers to horizontal and vertical lines.
std::list< std::pair< Geom::Point, Geom::Point > > LineList
bool getBool(Glib::ustring const &pref_path, bool def=false)
Retrieve a Boolean value.
static Preferences * get()
Access the singleton Preferences object.
double getGridTolerance() const
bool isTargetSnappable(Inkscape::SnapTargetType const target) const
bool getSnapVisibleOnly() const
SnapManager * _snapmanager
bool _snap_enabled
true if this snapper is enabled, otherwise false
To do: update description of desktop.
double current_zoom() const
Geom::Affine const & d2w() const
Transformation from desktop to window coordinates.
bool is_yaxisdown() const
guint32 getMajorLineInterval() const
std::pair< Geom::Point, Geom::Point > getEffectiveOriginAndSpacing(int index=-1) const
Class to coordinate snapping operations.
SPNamedView const * getNamedView() const
Inkscape::SnapPreferences & snapprefs
SPDesktop const * getDesktop() const
Editable view implementation.
static auto basis(int dim)
static int calculate_scaling_factor(double length, int major)
static auto proj(Geom::Point const &p, int dim)
Grid Snapper for Rectangular and Axonometric Grids.
double Coord
Floating point type used to store coordinates.
std::optional< Crossing > OptCrossing
OptCrossing intersection(Ray const &r1, Line const &l2)
D2< T > rot90(D2< T > const &a)
double round_to_upper_multiple_plus(double x, double const c1, double const c0=0)
double round_to_lower_multiple_plus(double x, double c1, double c0=0.0)
Helper class to stream background task notifications as a series of messages.
SnapSourceType
enumerations of snap source types and snap target types.
@ SNAPTARGET_GRID_PERPENDICULAR
Singleton class to access the preferences file in a convenient way.
std::list< Inkscape::SnappedLine > grid_lines
std::list< Inkscape::SnappedPoint > points