From 35300c9822f9f84c8a011913235fd4e5dc2c5ac8 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Mon, 12 Jul 2010 07:51:13 +0200 Subject: - Snap while rotating an object using the selector tool - Rename the ConstraintLine class to SnapConstraint - Move some duplicated code to 2geom (bzr r9607) --- src/2geom/circle.cpp | 17 +++++++++++++++++ src/2geom/circle.h | 10 +++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'src/2geom') diff --git a/src/2geom/circle.cpp b/src/2geom/circle.cpp index c3cea0ae7..00b91de12 100644 --- a/src/2geom/circle.cpp +++ b/src/2geom/circle.cpp @@ -97,6 +97,23 @@ Circle::arc(Point const& initial, Point const& inner, Point const& final, return e.arc(initial, inner, final, _svg_compliant); } +void +Circle::getPath(std::vector &path_out) { + Path pb; + + D2 B; + Linear bo = Linear(0, 2 * M_PI); + + B[0] = cos(bo,4); + B[1] = sin(bo,4); + + B = B * m_ray + m_centre; + + pb.append(SBasisCurve(B)); + + path_out.push_back(pb); +} + } // end namespace Geom diff --git a/src/2geom/circle.h b/src/2geom/circle.h index 27d4fcc3f..c346b8c8f 100644 --- a/src/2geom/circle.h +++ b/src/2geom/circle.h @@ -38,7 +38,7 @@ #include <2geom/point.h> #include <2geom/exception.h> - +#include <2geom/path.h> namespace Geom { @@ -56,6 +56,11 @@ class Circle { } + Circle(Point center, double r) + : m_centre(center), m_ray(r) + { + } + Circle(double A, double B, double C, double D) { set(A, B, C, D); @@ -86,6 +91,9 @@ class Circle arc(Point const& initial, Point const& inner, Point const& final, bool _svg_compliant = true); + void + getPath(std::vector &path_out); + Point center() const { return m_centre; -- cgit v1.2.3