Home Reference Source Repository

js/SceneKit/SCNVector3EqualToVector3.js

  1. 'use strict'
  2.  
  3. //import SCNVector3 from './SCNVector3'
  4.  
  5. const _epsilon = 0.00001
  6.  
  7. /**
  8. * Returns a Boolean value that indicates whether the corresponding components of two vectors are equal.
  9. * @access public
  10. * @param {SCNVector3} a - The first vector.
  11. * @param {SCNVector3} b - The second vector.
  12. * @returns {boolean} -
  13. * @desc This function performs a numeric (not bitwise) comparison of each pair of component values.
  14. * @see https://developer.apple.com/documentation/scenekit/1409643-scnvector3equaltovector3
  15. */
  16. const SCNVector3EqualToVector3 = function(a, b) {
  17. return Math.abs(a.x - b.x) < _epsilon
  18. && Math.abs(a.y - b.y) < _epsilon
  19. && Math.abs(a.z - b.z) < _epsilon
  20. }
  21.  
  22. export default SCNVector3EqualToVector3