MCPcopy Create free account
hub / github.com/arrayfire/forge / trackballPoint

Function trackballPoint

src/backend/opengl/common.cpp:349–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349glm::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}

Callers 2

pollEventsMethod · 0.85
cursorHandlerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected