diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-10-21 22:48:31 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2013-10-21 22:48:31 +0000 |
| commit | 24ee2f028c2d6977bb27cce086b5bec05f97b6e7 (patch) | |
| tree | 8030ac174d03e55bb1d693a710aa8ed50ad268f5 /src | |
| parent | Update to trunk (diff) | |
| parent | remove confusing bitfield declaration. bitfield not even needed here. (diff) | |
| download | inkscape-24ee2f028c2d6977bb27cce086b5bec05f97b6e7.tar.gz inkscape-24ee2f028c2d6977bb27cce086b5bec05f97b6e7.zip | |
Update to trunk
(bzr r11950.1.188)
Diffstat (limited to 'src')
| -rw-r--r-- | src/2geom/line.h | 1 | ||||
| -rw-r--r-- | src/2geom/ray.h | 26 | ||||
| -rw-r--r-- | src/2geom/transforms.h | 1 | ||||
| -rw-r--r-- | src/sp-root.cpp | 2 | ||||
| -rw-r--r-- | src/sp-root.h | 2 | ||||
| -rw-r--r-- | src/ui/dialog/pixelartdialog.cpp | 2 |
6 files changed, 26 insertions, 8 deletions
diff --git a/src/2geom/line.h b/src/2geom/line.h index f2d31ecc6..ade67f818 100644 --- a/src/2geom/line.h +++ b/src/2geom/line.h @@ -41,6 +41,7 @@ #include <2geom/crossing.h> #include <2geom/exception.h> #include <2geom/ray.h> +#include <2geom/angle.h> namespace Geom { diff --git a/src/2geom/ray.h b/src/2geom/ray.h index 75cc72005..2fda06ff5 100644 --- a/src/2geom/ray.h +++ b/src/2geom/ray.h @@ -36,6 +36,8 @@ #include <2geom/bezier-curve.h> // for LineSegment #include <2geom/exception.h> #include <2geom/math-utils.h> +#include <2geom/transforms.h> +#include <2geom/angle.h> namespace Geom { @@ -146,17 +148,31 @@ double angle_between(Ray const& r1, Ray const& r2, bool cw = true) { return angle; } +/** + * @brief Returns the angle bisector for the two given rays. + * + * @a r1 is rotated half the way to @a r2 in either clockwise or counter-clockwise direction. + * + * @pre Both passed rays must have the same origin. + * + * @remarks If the versors of both given rays point in the same direction, the direction of the + * angle bisector ray depends on the third parameter: + * - If @a cw is set to @c true, the returned ray will equal the passed rays @a r1 and @a r2. + * - If @a cw is set to @c false, the returned ray will go in the opposite direction. + * + * @throws RangeError if the given rays do not have the same origins + */ inline -Ray make_angle_bisector_ray(Ray const& r1, Ray const& r2) +Ray make_angle_bisector_ray(Ray const& r1, Ray const& r2, bool cw = true) { if ( !are_near(r1.origin(), r2.origin()) ) { - THROW_RANGEERROR("passed rays have not the same origin"); + THROW_RANGEERROR("passed rays do not have the same origin"); } - Point M = middle_point(r1.pointAt(1), r2.pointAt(1) ); - if (angle_between(r1, r2) > M_PI) M = 2 * r1.origin() - M; - return Ray(r1.origin(), M); + Ray bisector(r1.origin(), r1.origin() + r1.versor() * Rotate(angle_between(r1, r2) / 2.0)); + + return (cw ? bisector : bisector.reverse()); } } // end namespace Geom diff --git a/src/2geom/transforms.h b/src/2geom/transforms.h index 869e955c7..7f5635747 100644 --- a/src/2geom/transforms.h +++ b/src/2geom/transforms.h @@ -39,6 +39,7 @@ #include <cmath> #include <2geom/forward.h> #include <2geom/affine.h> +#include <2geom/angle.h> namespace Geom { diff --git a/src/sp-root.cpp b/src/sp-root.cpp index c87c8397d..5466649a2 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -62,7 +62,7 @@ SPRoot::SPRoot() : SPGroup() this->width.unset(SVGLength::PERCENT, 1.0, 1.0); this->height.unset(SVGLength::PERCENT, 1.0, 1.0); - this->viewBox_set = FALSE; + this->viewBox_set = false; this->c2p.setIdentity(); diff --git a/src/sp-root.h b/src/sp-root.h index 47a37029d..2931391ff 100644 --- a/src/sp-root.h +++ b/src/sp-root.h @@ -41,7 +41,7 @@ public: SVGLength height; /* viewBox; */ - bool viewBox_set : true; + bool viewBox_set; Geom::Rect viewBox; /* preserveAspectRatio */ diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index ff527434e..cc7bbb277 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -421,7 +421,7 @@ void PixelArtDialogImpl::processLibdepixelize(SPImage *img) sp_repr_css_attr_unref(css); } - gchar *str = sp_svg_write_path(move(it->pathVector)); + gchar *str = sp_svg_write_path(Dialog::move(it->pathVector)); repr->setAttribute("d", str); g_free(str); |
