math.vector.functions.js 1.2 KB

12345678910111213141516171819202122232425262728
  1. /**
  2. * Creates a string representation of the Vector2
  3. * @param vector defines the Vector2 to stringify
  4. * @param decimalCount defines the number of decimals to use
  5. * @returns a string with the Vector2 coordinates.
  6. */
  7. export function Vector2ToFixed(vector, decimalCount) {
  8. return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)}}`;
  9. }
  10. /**
  11. * Creates a string representation of the Vector3
  12. * @param vector defines the Vector3 to stringify
  13. * @param decimalCount defines the number of decimals to use
  14. * @returns a string with the Vector3 coordinates.
  15. */
  16. export function Vector3ToFixed(vector, decimalCount) {
  17. return `{X: ${vector._x.toFixed(decimalCount)} Y: ${vector._y.toFixed(decimalCount)} Z: ${vector._z.toFixed(decimalCount)}}`;
  18. }
  19. /**
  20. * Creates a string representation of the Vector4
  21. * @param vector defines the Vector4 to stringify
  22. * @param decimalCount defines the number of decimals to use
  23. * @returns a string with the Vector4 coordinates.
  24. */
  25. export function Vector4ToFixed(vector, decimalCount) {
  26. return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)} W: ${vector.w.toFixed(decimalCount)}}`;
  27. }
  28. //# sourceMappingURL=math.vector.functions.js.map