Krita Source Code Documentation
Loading...
Searching...
No Matches
KisScreentoneScreentoneFunctions::DotsEllipseLinearEqualized Class Reference

#include <KisScreentoneScreentoneFunctions.h>

+ Inheritance diagram for KisScreentoneScreentoneFunctions::DotsEllipseLinearEqualized:

Public Member Functions

qreal operator() (qreal x, qreal y) const
 
- Public Member Functions inherited from KisScreentoneScreentoneFunctions::DotsEllipseLinear
qreal operator() (qreal x, qreal y) const
 

Detailed Description

Definition at line 101 of file KisScreentoneScreentoneFunctions.h.

Member Function Documentation

◆ operator()()

qreal KisScreentoneScreentoneFunctions::DotsEllipseLinearEqualized::operator() ( qreal x,
qreal y ) const

Definition at line 93 of file KisScreentoneScreentoneFunctions.cpp.

94{
95 // In theory, the cumulative function for this spot function is:
96 // "coverage = area of the intersection between the elliptical disk formed
97 // by the value, and the screen cell".
98 // This uses a piecewise cumulative function obtained analytically. First,
99 // the area of the elliptical disk is obtained. If the value is greater than
100 // "0.625" (value at which the elliptical disk touches the left and right
101 // screen cell borders) then the area of the left and right elliptical
102 // chords is subtracted; and if the value is greater than "0.78125" then the
103 // area of the top and bottom elliptical chords is also subtracted
104 const qreal z = DotsEllipseLinear::operator()(x, y);
105 constexpr qreal factor = 0.625;
106 constexpr qreal factorTimes2 = factor * 2.0;
107 const qreal zOverFactorTimes2 = z / factorTimes2;
108 const qreal zTimesPoint8OverFactorTimes2 = 0.8 * zOverFactorTimes2;
109 qreal result = M_PI * zOverFactorTimes2 * zTimesPoint8OverFactorTimes2;
110 if (z > 0.625) {
111 const qreal zOverFactorTimes2Squared = zOverFactorTimes2 * zOverFactorTimes2;
112 result -= 2.0 * (zOverFactorTimes2Squared * std::acos(factor / z) -
113 0.5 * std::sqrt(zOverFactorTimes2Squared - 0.25)) * 0.8;
114 }
115 if (z > 0.78125) {
116 const qreal zTimesPoint8OverFactorTimes2Squared =
117 zTimesPoint8OverFactorTimes2 * zTimesPoint8OverFactorTimes2;
118 result -= 2.0 * (zTimesPoint8OverFactorTimes2Squared * std::acos(factor / (0.8 * z)) -
119 0.5 * std::sqrt(zTimesPoint8OverFactorTimes2Squared - 0.25)) / 0.8;
120 }
121 return result;
122}
#define M_PI
Definition kis_global.h:111

References M_PI, and KisScreentoneScreentoneFunctions::DotsEllipseLinear::operator()().


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