Skip to content

Commit e70cb12

Browse files
zvezdochiotnoobie-iv
authored andcommitted
Replace STU dewarp spline initialization method by STEX version
* research #2
1 parent 1a7e763 commit e70cb12

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/core/filters/deskew/DewarpingView.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,17 @@ DewarpingView::~DewarpingView()
126126
void
127127
DewarpingView::initNewSpline(XSpline& spline, QPointF const& p1, QPointF const& p2)
128128
{
129+
int const num_points = 4;
129130
QLineF const line(p1, p2);
130131
spline.appendControlPoint(line.p1(), 0);
131-
spline.appendControlPoint(line.pointAt(1.0/4.0), 1);
132-
spline.appendControlPoint(line.pointAt(2.0/4.0), 1);
133-
spline.appendControlPoint(line.pointAt(3.0/4.0), 1);
132+
if (num_points > 2)
133+
{
134+
for (int i = 1; i < (num_points - 1); i++)
135+
{
136+
double frac = (double) i / (num_points - 1);
137+
spline.appendControlPoint(line.pointAt(frac), 1);
138+
}
139+
}
134140
spline.appendControlPoint(line.p2(), 0);
135141
}
136142

0 commit comments

Comments
 (0)