QuaternionCurve.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. class "QuaternionCurve"
  2. function QuaternionCurve:QuaternionCurve(...)
  3. for k,v in pairs(arg) do
  4. if type(v) == "table" then
  5. if v.__ptr ~= nil then
  6. arg[k] = v.__ptr
  7. end
  8. end
  9. end
  10. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  11. self.__ptr = Polycore.QuaternionCurve(unpack(arg))
  12. Polycore.__ptr_lookup[self.__ptr] = self
  13. end
  14. end
  15. function QuaternionCurve:interpolate(t, useShortestPath)
  16. local retVal = Polycore.QuaternionCurve_interpolate(self.__ptr, t, useShortestPath)
  17. if retVal == nil then return nil end
  18. if Polycore.__ptr_lookup[retVal] ~= nil then
  19. return Polycore.__ptr_lookup[retVal]
  20. else
  21. Polycore.__ptr_lookup[retVal] = Quaternion("__skip_ptr__")
  22. Polycore.__ptr_lookup[retVal].__ptr = retVal
  23. return Polycore.__ptr_lookup[retVal]
  24. end
  25. end
  26. function QuaternionCurve:generatePointsFromCurves(wCurve, xCurve, yCurve, zCurve)
  27. local retVal = Polycore.QuaternionCurve_generatePointsFromCurves(self.__ptr, wCurve.__ptr, xCurve.__ptr, yCurve.__ptr, zCurve.__ptr)
  28. end
  29. function QuaternionCurve:recalcTangents()
  30. local retVal = Polycore.QuaternionCurve_recalcTangents(self.__ptr)
  31. end
  32. function QuaternionCurve:__delete()
  33. Polycore.__ptr_lookup[self.__ptr] = nil
  34. Polycore.delete_QuaternionCurve(self.__ptr)
  35. end