MCPcopy Create free account
hub / github.com/OpenMW/openmw / sphereCoordToCartesian

Function sphereCoordToCartesian

components/debug/debugdraw.cpp:13–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include <osg/Vec3>
12
13static osg::Vec3 sphereCoordToCartesian(float theta, float phi, float r)
14{
15 osg::Vec3 returnVec = osg::Vec3(0.0, 0.0, 0.0);
16 float phiToHorizontal = osg::PI_2f - phi;
17 returnVec.x() = std::cos(theta);
18 returnVec.y() = std::sin(theta);
19 returnVec.z() = std::sin(phiToHorizontal);
20
21 returnVec.x() *= std::cos(phiToHorizontal);
22 returnVec.y() *= std::cos(phiToHorizontal);
23 returnVec.x() *= r;
24 returnVec.z() *= r;
25
26 returnVec.y() *= r;
27 return returnVec;
28}
29
30static void generateWireCube(osg::Geometry& geom, float dim)
31{

Callers 2

generateCylinderFunction · 0.85
generateSphereFunction · 0.85

Calls 1

Vec3Class · 0.50

Tested by

no test coverage detected