Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Krita
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tusooa Zhu
Krita
Commits
90a070f5
Commit
90a070f5
authored
Sep 25, 2014
by
Dmitry Kazakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix extrapolation in the backward 4-point interpolator
parent
46b755c4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
2 deletions
+53
-2
krita/image/kis_four_point_interpolator_backward.h
krita/image/kis_four_point_interpolator_backward.h
+14
-2
krita/image/tests/kis_warp_transform_worker_test.cpp
krita/image/tests/kis_warp_transform_worker_test.cpp
+38
-0
krita/image/tests/kis_warp_transform_worker_test.h
krita/image/tests/kis_warp_transform_worker_test.h
+1
-0
No files found.
krita/image/kis_four_point_interpolator_backward.h
View file @
90a070f5
...
...
@@ -75,15 +75,18 @@ public:
m_qB_varY
=
y
*
m_d
.
x
();
m_qC_varY
=
y
*
m_a
.
x
();
m_py
=
y
;
}
inline
QPointF
getValue
()
const
{
static
const
qreal
eps
=
1e-10
;
qreal
qB
=
m_qB_const
+
m_qB_varX
+
m_qB_varY
;
qreal
qC
=
m_qC_varX
+
m_qC_varY
;
qreal
nu
=
0.0
;
if
(
qAbs
(
m_qA
)
<
1e-10
)
{
if
(
qAbs
(
m_qA
)
<
eps
)
{
nu
=
-
qC
/
qB
;
}
else
{
qreal
D
=
pow2
(
qB
)
-
4
*
m_qA
*
qC
;
...
...
@@ -104,7 +107,15 @@ public:
}
}
qreal
mu
=
(
m_px
-
nu
*
m_c
.
x
())
/
(
m_a
.
x
()
+
nu
*
m_d
.
x
());
qreal
xBasedDenominator
=
m_a
.
x
()
+
nu
*
m_d
.
x
();
qreal
mu
;
if
(
qAbs
(
xBasedDenominator
)
>
eps
)
{
mu
=
(
m_px
-
nu
*
m_c
.
x
())
/
xBasedDenominator
;
}
else
{
mu
=
(
m_py
-
nu
*
m_c
.
y
())
/
(
m_a
.
y
()
+
nu
*
m_d
.
y
());
}
return
m_srcBase
+
QPointF
(
mu
*
m_xCoeff
,
nu
*
m_yCoeff
);
}
...
...
@@ -123,6 +134,7 @@ private:
qreal
m_qC_varY
;
// quadratic equation C coeff, Y-dep part
qreal
m_qD_div
;
// inverted divisor of the quadratic equation solution
qreal
m_px
;
// saved relative X coordinate
qreal
m_py
;
// saved relative Y coordinate
QPointF
m_srcBase
;
QPointF
m_dstBase
;
...
...
krita/image/tests/kis_warp_transform_worker_test.cpp
View file @
90a070f5
...
...
@@ -285,4 +285,42 @@ void KisWarpTransformWorkerTest::testGridSize()
QCOMPARE
(
GridIterationTools
::
calcGridDimension
(
0
,
300
,
8
),
39
);
}
void
KisWarpTransformWorkerTest
::
testBackwardInterpolatorExtrapolation
()
{
QPolygonF
src
;
src
<<
QPointF
(
0
,
0
);
src
<<
QPointF
(
100
,
0
);
src
<<
QPointF
(
100
,
100
);
src
<<
QPointF
(
0
,
100
);
QPolygonF
dst
(
src
);
std
::
rotate
(
dst
.
begin
(),
dst
.
begin
()
+
1
,
dst
.
end
());
KisFourPointInterpolatorBackward
interp
(
src
,
dst
);
// standard checks
QCOMPARE
(
interp
.
map
(
QPointF
(
0
,
0
)),
QPointF
(
0
,
100
));
QCOMPARE
(
interp
.
map
(
QPointF
(
100
,
0
)),
QPointF
(
0
,
0
));
QCOMPARE
(
interp
.
map
(
QPointF
(
100
,
100
)),
QPointF
(
100
,
0
));
QCOMPARE
(
interp
.
map
(
QPointF
(
0
,
100
)),
QPointF
(
100
,
100
));
// extrapolate!
QCOMPARE
(
interp
.
map
(
QPointF
(
-
10
,
0
)),
QPointF
(
0
,
110
));
QCOMPARE
(
interp
.
map
(
QPointF
(
0
,
-
10
)),
QPointF
(
-
10
,
100
));
QCOMPARE
(
interp
.
map
(
QPointF
(
-
10
,
-
10
)),
QPointF
(
-
10
,
110
));
QCOMPARE
(
interp
.
map
(
QPointF
(
110
,
0
)),
QPointF
(
0
,
-
10
));
QCOMPARE
(
interp
.
map
(
QPointF
(
100
,
-
10
)),
QPointF
(
-
10
,
0
));
QCOMPARE
(
interp
.
map
(
QPointF
(
110
,
-
10
)),
QPointF
(
-
10
,
-
10
));
QCOMPARE
(
interp
.
map
(
QPointF
(
110
,
100
)),
QPointF
(
100
,
-
10
));
QCOMPARE
(
interp
.
map
(
QPointF
(
100
,
110
)),
QPointF
(
110
,
0
));
QCOMPARE
(
interp
.
map
(
QPointF
(
110
,
110
)),
QPointF
(
110
,
-
10
));
QCOMPARE
(
interp
.
map
(
QPointF
(
-
10
,
100
)),
QPointF
(
100
,
110
));
QCOMPARE
(
interp
.
map
(
QPointF
(
0
,
110
)),
QPointF
(
110
,
100
));
QCOMPARE
(
interp
.
map
(
QPointF
(
-
10
,
110
)),
QPointF
(
110
,
110
));
}
QTEST_KDEMAIN
(
KisWarpTransformWorkerTest
,
GUI
)
krita/image/tests/kis_warp_transform_worker_test.h
View file @
90a070f5
...
...
@@ -33,6 +33,7 @@ private slots:
void
testBackwardInterpolatorXYShear
();
void
testBackwardInterpolatorRoundTrip
();
void
testGridSize
();
void
testBackwardInterpolatorExtrapolation
();
};
#endif
/* __KIS_WARP_TRANSFORM_WORKER_TEST_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment