MCPcopy Create free account
hub / github.com/collin80/SavvyCAN / coordToCell

Method coordToCell

qcustomplot.cpp:25458–25464  ·  view source on GitHub ↗

! Transforms plot coordinates given by \a key and \a value to cell indices of this QCPColorMapData instance. The resulting cell indices are returned via the output parameters \a keyIndex and \a valueIndex. The retrieved key/value cell indices can then be used for example with \ref setCell. If you are only interested in a key or value index, you may pass 0 as \a valueIndex or \a k

Source from the content-addressed store, hash-verified

25456 \see cellToCoord, QCPAxis::coordToPixel
25457*/
25458void QCPColorMapData::coordToCell(double key, double value, int *keyIndex, int *valueIndex) const
25459{
25460 if (keyIndex)
25461 *keyIndex = (key-mKeyRange.lower)/(mKeyRange.upper-mKeyRange.lower)*(mKeySize-1)+0.5;
25462 if (valueIndex)
25463 *valueIndex = (value-mValueRange.lower)/(mValueRange.upper-mValueRange.lower)*(mValueSize-1)+0.5;
25464}
25465
25466/*!
25467 Transforms cell indices given by \a keyIndex and \a valueIndex to cell indices of this QCPColorMapData

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected