Advertisement
Guest User

Untitled

a guest
Nov 20th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. ---------------------------------------------------------------------------------------------------
  2. -- this functions moves an array of points to it's new location relative to the old origin,
  3. -- so the distance and bearing between the points and the old origin are the same for the new origin
  4. -- NOTE: On some devices the calls are 'call by value' and on others 'call by reference'
  5. --
  6. -- @param:
  7. --      zPoints: Points (array of ZonePoints)
  8. --      oldOrigin: OriginalPoint
  9. --      newOrigin: OriginalPoint
  10. -- @return:
  11. --      zPoints: Points (array of ZonePoints)
  12. function translatePointsRelativeSafe(zPoints, oldOrigin, newOrigin)
  13.  
  14.     local index
  15.     local value
  16.     local bearing
  17.     local distance
  18.  
  19.     for index, value in pairs(zPoints) do
  20.         distance, bearing = VectorToPointSafeToUseOniPhone(oldOrigin, zPoints[index])
  21.         zPoints[index] = Wherigo.TranslatePoint(newOrigin, distance, bearing)
  22.     end
  23.  
  24.     return zPoints
  25. end
  26. ---------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement