mirror of https://github.com/CGAL/cgal
Add fitting of a line through segments
This commit is contained in:
parent
9f149a3ab5
commit
822bd15b47
|
|
@ -77,6 +77,7 @@ public slots:
|
||||||
void on_actionRecenter_triggered();
|
void on_actionRecenter_triggered();
|
||||||
void on_actionInnerSkeleton_triggered();
|
void on_actionInnerSkeleton_triggered();
|
||||||
void on_actionLinearLeastSquaresFitting_triggered();
|
void on_actionLinearLeastSquaresFitting_triggered();
|
||||||
|
void on_actionLinearLeastSquaresFittingOfSegments_triggered();
|
||||||
void on_actionCreateInputPolygon_toggled(bool);
|
void on_actionCreateInputPolygon_toggled(bool);
|
||||||
|
|
||||||
void on_actionYMonotonePartition_triggered();
|
void on_actionYMonotonePartition_triggered();
|
||||||
|
|
@ -323,17 +324,33 @@ MainWindow::on_actionLinearLeastSquaresFitting_triggered()
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
Line_2 line;
|
Line_2 line;
|
||||||
CGAL::linear_least_squares_fitting_2(poly.vertices_begin(),
|
CGAL::linear_least_squares_fitting_2(poly.vertices_begin(),
|
||||||
poly.vertices_end(),
|
poly.vertices_end(),
|
||||||
line,
|
line,
|
||||||
CGAL::Dimension_tag<0>());
|
CGAL::Dimension_tag<0>());
|
||||||
|
|
||||||
// Line_2 line (Point_2(0,0), Point_2(1,1));
|
lgi->setLine(line);
|
||||||
lgi->setLine(line);
|
lgi->show();
|
||||||
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
|
void
|
||||||
MainWindow::on_actionYMonotonePartition_triggered()
|
MainWindow::on_actionYMonotonePartition_triggered()
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@
|
||||||
<addaction name="actionOptimalConvexPartition" />
|
<addaction name="actionOptimalConvexPartition" />
|
||||||
<addaction name="actionInnerSkeleton" />
|
<addaction name="actionInnerSkeleton" />
|
||||||
<addaction name="actionLinearLeastSquaresFitting" />
|
<addaction name="actionLinearLeastSquaresFitting" />
|
||||||
|
<addaction name="actionLinearLeastSquaresFittingOfSegments" />
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuFile" />
|
<addaction name="menuFile" />
|
||||||
<addaction name="menuEdit" />
|
<addaction name="menuEdit" />
|
||||||
|
|
@ -221,7 +222,12 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionLinearLeastSquaresFitting" >
|
<action name="actionLinearLeastSquaresFitting" >
|
||||||
<property name="text" >
|
<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>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue