| 143 | } |
| 144 | |
| 145 | bool Falcor::SelectionWheel::isMouseOnGroup(const float2& mousePos, uint32_t groupIndex, uint32_t& sectorIndex) |
| 146 | { |
| 147 | FALCOR_CHECK(groupIndex < (uint32_t)mDescription.sectorGroups.size(), "'groupIndex' ({}) is out of bounds.", groupIndex); |
| 148 | |
| 149 | float dirLength, mouseAngle; |
| 150 | computeMouseAngleAndDirLength(mousePos, mouseAngle, dirLength); |
| 151 | |
| 152 | float minRotation = getRotationOfSector(groupIndex, 0); |
| 153 | float sectorAngle = getAngleOfSectorInGroup(groupIndex); |
| 154 | float maxRotation = minRotation + sectorAngle * mDescription.sectorGroups[groupIndex]; |
| 155 | |
| 156 | bool isInGroup = minRotation <= mouseAngle && mouseAngle <= maxRotation && dirLength >= mDescription.minRadius && |
| 157 | dirLength <= mDescription.maxRadius; |
| 158 | |
| 159 | if (isInGroup) |
| 160 | { |
| 161 | sectorIndex = (uint32_t)std::floor((mouseAngle - minRotation) / sectorAngle); |
| 162 | } |
| 163 | else |
| 164 | { |
| 165 | sectorIndex = kInvalidIndex; |
| 166 | } |
| 167 | |
| 168 | return isInGroup; |
| 169 | } |
| 170 | |
| 171 | float2 Falcor::SelectionWheel::getCenterPositionOfSector(uint32_t groupIndex, uint32_t sectorIndex) |
| 172 | { |
no test coverage detected