MCPcopy Create free account
hub / github.com/cutechess/cutechess / coordToRadius

Method coordToRadius

projects/gui/3rdparty/qcustomplot/qcustomplot.cpp:32059–32081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32057}
32058
32059double QCPPolarAxisRadial::coordToRadius(double coord) const
32060{
32061 if (mScaleType == stLinear)
32062 {
32063 if (!mRangeReversed)
32064 return (coord-mRange.lower)/mRange.size()*mRadius;
32065 else
32066 return (mRange.upper-coord)/mRange.size()*mRadius;
32067 } else // mScaleType == stLogarithmic
32068 {
32069 if (coord >= 0.0 && mRange.upper < 0.0) // invalid value for logarithmic scale, just return outside visible range
32070 return !mRangeReversed ? mRadius+200 : mRadius-200;
32071 else if (coord <= 0.0 && mRange.upper >= 0.0) // invalid value for logarithmic scale, just return outside visible range
32072 return !mRangeReversed ? mRadius-200 :mRadius+200;
32073 else
32074 {
32075 if (!mRangeReversed)
32076 return qLn(coord/mRange.lower)/qLn(mRange.upper/mRange.lower)*mRadius;
32077 else
32078 return qLn(mRange.upper/coord)/qLn(mRange.upper/mRange.lower)*mRadius;
32079 }
32080 }
32081}
32082
32083double QCPPolarAxisRadial::radiusToCoord(double radius) const
32084{

Callers 1

drawRadialGridMethod · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected