Krita Source Code Documentation
Loading...
Searching...
No Matches
KisFourPointInterpolatorForward Class Reference

#include <kis_four_point_interpolator_forward.h>

Public Member Functions

QPointF getValue () const
 
 KisFourPointInterpolatorForward (const QPolygonF &srcPolygon, const QPolygonF &dstPolygon)
 
QPointF map (const QPointF &pt)
 
void setX (qreal x)
 
void setY (qreal y)
 

Private Attributes

QPointF m_dstBase
 
qreal m_forwardCoeffX
 
qreal m_forwardCoeffY
 
QPointF m_h0
 
QPointF m_h1
 
QPointF m_srcBase
 
QPointF m_v0
 
qreal m_xProp
 
qreal m_yProp
 

Detailed Description

A--—B The polygons must be initialized in this order: | | | | polygon << A << B << D << C; C--—D

Definition at line 22 of file kis_four_point_interpolator_forward.h.

Constructor & Destructor Documentation

◆ KisFourPointInterpolatorForward()

KisFourPointInterpolatorForward::KisFourPointInterpolatorForward ( const QPolygonF & srcPolygon,
const QPolygonF & dstPolygon )
inline

Definition at line 25 of file kis_four_point_interpolator_forward.h.

25 {
26 m_srcBase = srcPolygon[0];
27 m_dstBase = dstPolygon[0];
28
29 m_h0 = dstPolygon[1] - dstPolygon[0]; // BA
30 m_h1 = dstPolygon[2] - dstPolygon[3]; // DC
31
32 m_v0 = dstPolygon[3] - dstPolygon[0]; // CA
33
34 m_forwardCoeffX = 1.0 / (srcPolygon[1].x() - srcPolygon[0].x());
35 m_forwardCoeffY = 1.0 / (srcPolygon[3].y() - srcPolygon[0].y());
36
37 m_xProp = 0;
38 m_yProp = 0;
39 }

References m_dstBase, m_forwardCoeffX, m_forwardCoeffY, m_h0, m_h1, m_srcBase, m_v0, m_xProp, and m_yProp.

Member Function Documentation

◆ getValue()

QPointF KisFourPointInterpolatorForward::getValue ( ) const
inline

Definition at line 57 of file kis_four_point_interpolator_forward.h.

57 {
58 QPointF dstPoint = m_dstBase +
59 m_yProp * m_v0 +
60 m_xProp * (m_yProp * m_h1 + (1.0 - m_yProp) * m_h0);
61
62 return dstPoint;
63 }
QPointF dstPoint

References dstPoint, m_dstBase, m_h0, m_h1, m_v0, m_xProp, and m_yProp.

◆ map()

QPointF KisFourPointInterpolatorForward::map ( const QPointF & pt)
inline

◆ setX()

void KisFourPointInterpolatorForward::setX ( qreal x)
inline

Definition at line 47 of file kis_four_point_interpolator_forward.h.

47 {
48 qreal diff = x - m_srcBase.x();
49 m_xProp = diff * m_forwardCoeffX;
50 }

References m_forwardCoeffX, m_srcBase, and m_xProp.

◆ setY()

void KisFourPointInterpolatorForward::setY ( qreal y)
inline

Definition at line 52 of file kis_four_point_interpolator_forward.h.

52 {
53 qreal diff = y - m_srcBase.y();
54 m_yProp = diff * m_forwardCoeffY;
55 }

References m_forwardCoeffY, m_srcBase, and m_yProp.

Member Data Documentation

◆ m_dstBase

QPointF KisFourPointInterpolatorForward::m_dstBase
private

Definition at line 67 of file kis_four_point_interpolator_forward.h.

◆ m_forwardCoeffX

qreal KisFourPointInterpolatorForward::m_forwardCoeffX
private

Definition at line 73 of file kis_four_point_interpolator_forward.h.

◆ m_forwardCoeffY

qreal KisFourPointInterpolatorForward::m_forwardCoeffY
private

Definition at line 74 of file kis_four_point_interpolator_forward.h.

◆ m_h0

QPointF KisFourPointInterpolatorForward::m_h0
private

Definition at line 69 of file kis_four_point_interpolator_forward.h.

◆ m_h1

QPointF KisFourPointInterpolatorForward::m_h1
private

Definition at line 70 of file kis_four_point_interpolator_forward.h.

◆ m_srcBase

QPointF KisFourPointInterpolatorForward::m_srcBase
private

Definition at line 66 of file kis_four_point_interpolator_forward.h.

◆ m_v0

QPointF KisFourPointInterpolatorForward::m_v0
private

Definition at line 71 of file kis_four_point_interpolator_forward.h.

◆ m_xProp

qreal KisFourPointInterpolatorForward::m_xProp
private

Definition at line 76 of file kis_four_point_interpolator_forward.h.

◆ m_yProp

qreal KisFourPointInterpolatorForward::m_yProp
private

Definition at line 77 of file kis_four_point_interpolator_forward.h.


The documentation for this class was generated from the following file: