summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-05-10 19:27:46 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-05-10 19:27:46 +0000
commit63b289b4a3341f435e49dde40503636ba7b01b6a (patch)
tree885711fcf5455453561c3b9d03a14d72cf7b0897 /src
parentWorking on Krzysztof review. Seems to be all fixed. (diff)
downloadinkscape-63b289b4a3341f435e49dde40503636ba7b01b6a.tar.gz
inkscape-63b289b4a3341f435e49dde40503636ba7b01b6a.zip
Added some comments
(bzr r13645.1.90)
Diffstat (limited to 'src')
-rw-r--r--src/helper/geom-pathinfo.cpp30
-rw-r--r--src/helper/geom-pathinfo.h4
-rw-r--r--src/helper/geom-pointwise.h2
-rw-r--r--src/helper/geom-satellite.cpp6
4 files changed, 29 insertions, 13 deletions
diff --git a/src/helper/geom-pathinfo.cpp b/src/helper/geom-pathinfo.cpp
index 5ffd1d31e..d37b8b6da 100644
--- a/src/helper/geom-pathinfo.cpp
+++ b/src/helper/geom-pathinfo.cpp
@@ -1,6 +1,8 @@
/**
* \file
- * \brief Pathinfo store the _data of a Geom::PathVector and allow get info about it
+ * \brief Pathinfo iterate a Geom::PathVector and allow get info about it.
+ * \Usualy need a curve index to get the results
+ * \TODO: migrate more Inkscape loops to use it.
*/ /*
* Authors:
* 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es>
@@ -69,24 +71,30 @@ void Pathinfo::set(Geom::PathVector path_vector, bool skip_degenerate)
}
}
+/** Size of pathvector
+ */
size_t Pathinfo::size() const
{
return _data.back().first + 1;
}
-size_t Pathinfo::subPathSize(size_t index) const
+/** Size of subpath
+ */
+size_t Pathinfo::subPathSize(size_t subpath_index) const
{
size_t size = 0;
- if( _data.size() > index){
+ if( _data.size() > subpath_index){
double prev = 0;
- if(index != 0){
- prev = _data[index - 1].first;
+ if(subpath_index != 0){
+ prev = _data[subpath_index - 1].first;
}
- size = prev - _data[index].first + 1;
+ size = prev - _data[subpath_index].first + 1;
}
return size;
}
+/** Get subpath index from a curve index
+ */
size_t Pathinfo::subPathIndex(size_t index) const
{
for (size_t i = 0; i < _data.size(); i++) {
@@ -97,6 +105,8 @@ size_t Pathinfo::subPathIndex(size_t index) const
return 0;
}
+/** Get subpath last index given a curve index
+ */
size_t Pathinfo::last(size_t index) const
{
for (size_t i = 0; i < _data.size(); i++) {
@@ -107,6 +117,8 @@ size_t Pathinfo::last(size_t index) const
return 0;
}
+/** Get subpath first index given a curve index
+ */
size_t Pathinfo::first(size_t index) const
{
for (size_t i = 0; i < _data.size(); i++) {
@@ -121,6 +133,8 @@ size_t Pathinfo::first(size_t index) const
return 0;
}
+/** Get previous index given a curve index
+ */
boost::optional<size_t> Pathinfo::previous(size_t index) const
{
if (first(index) == index && closed(index)) {
@@ -132,6 +146,8 @@ boost::optional<size_t> Pathinfo::previous(size_t index) const
return index - 1;
}
+/** Get next index given a curve index
+ */
boost::optional<size_t> Pathinfo::next(size_t index) const
{
if (last(index) == index && closed(index)) {
@@ -143,6 +159,8 @@ boost::optional<size_t> Pathinfo::next(size_t index) const
return index + 1;
}
+/** Get if subpath is closed given a curve index
+ */
bool Pathinfo::closed(size_t index) const
{
for (size_t i = 0; i < _data.size(); i++) {
diff --git a/src/helper/geom-pathinfo.h b/src/helper/geom-pathinfo.h
index 8a6c51e51..cd3a3b2b8 100644
--- a/src/helper/geom-pathinfo.h
+++ b/src/helper/geom-pathinfo.h
@@ -1,6 +1,6 @@
/**
* \file
- * \brief Pathinfo store data of a Geom::PathVector and allow get info about it
+ * \brief Pathinfo iterate a Geom::PathVector and allow get info about it.
* \
*/ /*
* Authors:
@@ -29,7 +29,7 @@ public:
void set(Geom::PathVector path_vector, bool skip_degenerate = false);
std::vector<std::pair<size_t, bool> > get(){return _data;};
size_t size() const;
- size_t subPathSize(size_t index) const;
+ size_t subPathSize(size_t subpath_index) const;
size_t subPathIndex(size_t index) const;
size_t last(size_t index) const;
size_t first(size_t index) const;
diff --git a/src/helper/geom-pointwise.h b/src/helper/geom-pointwise.h
index b1f2235c6..3cb4ff136 100644
--- a/src/helper/geom-pointwise.h
+++ b/src/helper/geom-pointwise.h
@@ -1,6 +1,6 @@
/**
* \file
- * \brief Pointwise a class to manage a vector of satellites per piecewise curve
+ * \brief Pointwise a class to manage a vector of satellites, once per piecewise curve
*/ /*
* Authors:
* 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es>
diff --git a/src/helper/geom-satellite.cpp b/src/helper/geom-satellite.cpp
index c2d4ef715..d03839875 100644
--- a/src/helper/geom-satellite.cpp
+++ b/src/helper/geom-satellite.cpp
@@ -80,8 +80,7 @@ double arcLengthAt(double A, Geom::D2<Geom::SBasis> const d2_in)
}
/**
- * Calculate the length of a satellite from a radious A input.
- * convert a arc radius to a satellite length
+ * Convert a arc radius of a fillet/chamfer to his satellite length -point position where fillet/chamferknot be on original curve
*/
double Satellite::radToLen(
double A, Geom::D2<Geom::SBasis> const d2_in,
@@ -111,8 +110,7 @@ double Satellite::radToLen(
}
/**
-* Calculate the radious of a satellite from a length A input.
-* convert a satellite length to a arc radius
+* Convert a satelite length -point position where fillet/chamfer knot be on original curve- to a arc radius of fillet/chamfer
*/
double Satellite::lenToRad(
double A, Geom::D2<Geom::SBasis> const d2_in,