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

#include <KisScreentoneScreentoneFunctions.h>

+ Inheritance diagram for KisScreentoneScreentoneFunctions::DotsRoundLinearEqualized:

Public Member Functions

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

Detailed Description

Definition at line 77 of file KisScreentoneScreentoneFunctions.h.

Member Function Documentation

◆ operator()()

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

Definition at line 41 of file KisScreentoneScreentoneFunctions.cpp.

42{
43 // In theory, the cumulative function for this spot function is:
44 // "coverage = area of the intersection between the disk formed by the value,
45 // and the screen cell".
46 // This uses a piecewise cumulative function obtained analytically. If
47 // the value is less than or equal to "sqrt(2) / 2" (value at which the
48 // disk touches the screen cell borders) then the coverage for that value
49 // is obtained simply by getting the area of the disk. If the value is
50 // greater than "sqrt(2) / 2" then the coverage is obtained by computing
51 // the area of the intersection between the disk and the screen cell (area
52 // of the disk minus area of the chords of the disk outside the screen cell)
53 const qreal z = DotsRoundLinear::operator()(x, y);
54 const qreal zOverSqrt2 = z / M_SQRT2;
55 const qreal zOverSqrt2Squared = zOverSqrt2 * zOverSqrt2;
56 if (z <= M_SQRT2 / 2.0) {
57 return M_PI * zOverSqrt2Squared;
58 } else {
59 return M_PI * zOverSqrt2Squared -
60 4.0 * (zOverSqrt2Squared * std::acos(M_SQRT2 / (2.0 * z)) -
61 0.5 * std::sqrt(zOverSqrt2Squared - 0.25));
62 }
63}
#define M_PI
Definition kis_global.h:111

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


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