Add fitting of a line through segments

This commit is contained in:
Andreas Fabri 2008-10-17 18:12:58 +00:00
parent 9f149a3ab5
commit 822bd15b47
2 changed files with 32 additions and 9 deletions

View File

@ -77,6 +77,7 @@ public slots:
void on_actionRecenter_triggered();
void on_actionInnerSkeleton_triggered();
void on_actionLinearLeastSquaresFitting_triggered();
void on_actionLinearLeastSquaresFittingOfSegments_triggered();
void on_actionCreateInputPolygon_toggled(bool);
void on_actionYMonotonePartition_triggered();
@ -328,12 +329,28 @@ MainWindow::on_actionLinearLeastSquaresFitting_triggered()
line,
CGAL::Dimension_tag<0>());
// Line_2 line (Point_2(0,0), Point_2(1,1));
lgi->setLine(line);
lgi->show();
}
}
void
MainWindow::on_actionLinearLeastSquaresFittingOfSegments_triggered()
{
if(poly.size()>2){
clear();
Line_2 line;
CGAL::linear_least_squares_fitting_2(poly.edges_begin(),
poly.edges_end(),
line,
CGAL::Dimension_tag<1>());
lgi->setLine(line);
lgi->show();
}
}
void
MainWindow::on_actionYMonotonePartition_triggered()

View File

@ -120,6 +120,7 @@
<addaction name="actionOptimalConvexPartition" />
<addaction name="actionInnerSkeleton" />
<addaction name="actionLinearLeastSquaresFitting" />
<addaction name="actionLinearLeastSquaresFittingOfSegments" />
</widget>
<addaction name="menuFile" />
<addaction name="menuEdit" />
@ -221,7 +222,12 @@
</action>
<action name="actionLinearLeastSquaresFitting" >
<property name="text" >
<string>Linear Least Squares Fitting</string>
<string>Linear Least Squares Fitting of Points</string>
</property>
</action>
<action name="actionLinearLeastSquaresFittingOfSegments" >
<property name="text" >
<string>Linear Least Squares Fitting of Segments</string>
</property>
</action>
</widget>