approximateSphericalCoordinates.js 944 B

1234567891011121314151617181920
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "/**\n\
  3. * Approximately computes spherical coordinates given a normal.\n\
  4. * Uses approximate inverse trigonometry for speed and consistency,\n\
  5. * since inverse trigonometry can differ from vendor-to-vendor and when compared with the CPU.\n\
  6. *\n\
  7. * @name czm_approximateSphericalCoordinates\n\
  8. * @glslFunction\n\
  9. *\n\
  10. * @param {vec3} normal arbitrary-length normal.\n\
  11. *\n\
  12. * @returns {vec2} Approximate latitude and longitude spherical coordinates.\n\
  13. */\n\
  14. vec2 czm_approximateSphericalCoordinates(vec3 normal) {\n\
  15. // Project into plane with vertical for latitude\n\
  16. float latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);\n\
  17. float longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);\n\
  18. return vec2(latitudeApproximation, longitudeApproximation);\n\
  19. }\n\
  20. ";