| 347 | } |
| 348 | |
| 349 | glm::vec3 trackballPoint(const float pX, const float pY, |
| 350 | const float pWidth, const float pHeight) |
| 351 | { |
| 352 | glm::vec3 P = glm::vec3(1.0*pX/pWidth*2 - 1.0, 1.0*pY/pHeight*2 - 1.0, 0); |
| 353 | |
| 354 | P.y = -P.y; |
| 355 | float OP_squared = P.x * P.x + P.y * P.y; |
| 356 | if (OP_squared <= 1*1) { |
| 357 | P.z = sqrt(1*1 - OP_squared); |
| 358 | } else { |
| 359 | P.z = 0; |
| 360 | P = glm::normalize(P); |
| 361 | } |
| 362 | return P; |
| 363 | } |
no outgoing calls
no test coverage detected