summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-14 11:07:52 (GMT)
committerkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-14 11:07:52 (GMT)
commitf8797d493780718d33e63e1c47b23617c0ec00aa (patch)
treecc961ff647206ff08c42d0bc5671f7b2bd7c281f
parent098b9d61b8bb5b727db64270226479f4069bf30f (diff)
comments + removed redundant iteration over index 0
git-svn-id: http://svn.clifford.at/openscad/trunk@293 b57f626f-c46c-0410-a088-ec61d464b74c
-rw-r--r--dxfdata.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/dxfdata.cc b/dxfdata.cc
index 9829033..747101f 100644
--- a/dxfdata.cc
+++ b/dxfdata.cc
@@ -428,6 +428,10 @@ DxfData::DxfData(double fn, double fs, double fa, QString filename, QString laye
#endif
}
+/*!
+ Ensures that all paths have the same vertex ordering.
+ FIXME: CW or CCW?
+*/
void DxfData::fixup_path_direction()
{
for (int i = 0; i < this->paths.count(); i++) {
@@ -436,7 +440,7 @@ void DxfData::fixup_path_direction()
this->paths[i].is_inner = true;
double min_x = this->paths[i].points[0]->x;
int min_x_point = 0;
- for (int j = 0; j < this->paths[i].points.count(); j++) {
+ for (int j = 1; j < this->paths[i].points.count(); j++) {
if (this->paths[i].points[j]->x < min_x) {
min_x = this->paths[i].points[j]->x;
min_x_point = j;
@@ -456,6 +460,7 @@ void DxfData::fixup_path_direction()
printf(" b->a vector = %f %f (%f)\n", ax, ay, atan2(ax, ay));
printf(" b->c vector = %f %f (%f)\n", cx, cy, atan2(cx, cy));
#endif
+ // FIXME: atan2() usually takes y,x. This variant probably makes the path clockwise..
if (atan2(ax, ay) < atan2(cx, cy)) {
for (int j = 0; j < this->paths[i].points.count()/2; j++)
this->paths[i].points.swap(j, this->paths[i].points.count()-1-j);
contact: Jan Huwald // Impressum