BezierCurve.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. function BezierCurve() {
  2. Object.defineProperties(this, {
  3. 'insertPoint': { enumerable: true, configurable: true, get: BezierCurve.prototype.__get_insertPoint, set: BezierCurve.prototype.__set_insertPoint},
  4. 'evaluationAccuracy': { enumerable: true, configurable: true, get: BezierCurve.prototype.__get_evaluationAccuracy, set: BezierCurve.prototype.__set_evaluationAccuracy}
  5. })
  6. }
  7. BezierCurve.prototype.__get_insertPoint = function() {
  8. var retVal = new BezierPoint()
  9. retVal.__ptr = Polycode.BezierCurve__get_insertPoint(this.__ptr)
  10. return retVal
  11. }
  12. BezierCurve.prototype.__set_insertPoint = function(val) {
  13. Polycode.BezierCurve__set_insertPoint(this.__ptr, val.__ptr)
  14. }
  15. BezierCurve.prototype.__get_evaluationAccuracy = function() {
  16. return Polycode.BezierCurve__get_evaluationAccuracy(this.__ptr)
  17. }
  18. BezierCurve.prototype.__set_evaluationAccuracy = function(val) {
  19. Polycode.BezierCurve__set_evaluationAccuracy(this.__ptr, val)
  20. }
  21. Duktape.fin(BezierCurve.prototype, function (x) {
  22. if (x === BezierCurve.prototype) {
  23. return;
  24. }
  25. Polycode.BezierCurve__delete(x.__ptr)
  26. })
  27. BezierCurve.prototype.getControlPoint = function(index) {
  28. var retVal = new BezierPoint()
  29. retVal.__ptr = Polycode.BezierCurve_getControlPoint(this.__ptr, index)
  30. return retVal
  31. }
  32. BezierCurve.prototype.getNumControlPoints = function() {
  33. return Polycode.BezierCurve_getNumControlPoints(this.__ptr)
  34. }
  35. BezierCurve.prototype.addControlPoint = function(p1x,p1y,p1z,p2x,p2y,p2z,p3x,p3y,p3z) {
  36. Polycode.BezierCurve_addControlPoint(this.__ptr, p1x,p1y,p1z,p2x,p2y,p2z,p3x,p3y,p3z)
  37. }
  38. BezierCurve.prototype.addControlPoint3dWithHandles = function(p1x,p1y,p1z,p2x,p2y,p2z,p3x,p3y,p3z) {
  39. Polycode.BezierCurve_addControlPoint3dWithHandles(this.__ptr, p1x,p1y,p1z,p2x,p2y,p2z,p3x,p3y,p3z)
  40. }
  41. BezierCurve.prototype.addControlPoint3d = function(x,y,z) {
  42. Polycode.BezierCurve_addControlPoint3d(this.__ptr, x,y,z)
  43. }
  44. BezierCurve.prototype.addControlPoint2dWithHandles = function(p1x,p1y,p2x,p2y,p3x,p3y) {
  45. Polycode.BezierCurve_addControlPoint2dWithHandles(this.__ptr, p1x,p1y,p2x,p2y,p3x,p3y)
  46. }
  47. BezierCurve.prototype.addControlPoint2d = function(x,y) {
  48. Polycode.BezierCurve_addControlPoint2d(this.__ptr, x,y)
  49. }
  50. BezierCurve.prototype.getPointAt = function(a) {
  51. var retVal = new Vector3()
  52. retVal.__ptr = Polycode.BezierCurve_getPointAt(this.__ptr, a)
  53. return retVal
  54. }
  55. BezierCurve.prototype.getPointBetween = function(a,bp1,bp2) {
  56. var retVal = new Vector3()
  57. retVal.__ptr = Polycode.BezierCurve_getPointBetween(this.__ptr, a,bp1,bp2)
  58. return retVal
  59. }
  60. BezierCurve.prototype.clearControlPoints = function() {
  61. Polycode.BezierCurve_clearControlPoints(this.__ptr)
  62. }
  63. BezierCurve.prototype.getYValueAtX = function(x) {
  64. return Polycode.BezierCurve_getYValueAtX(this.__ptr, x)
  65. }
  66. BezierCurve.prototype.getTValueAtX = function(x) {
  67. return Polycode.BezierCurve_getTValueAtX(this.__ptr, x)
  68. }
  69. BezierCurve.prototype.removePoint = function(point) {
  70. Polycode.BezierCurve_removePoint(this.__ptr, point)
  71. }
  72. BezierCurve.prototype.setHeightCacheResolution = function(resolution) {
  73. Polycode.BezierCurve_setHeightCacheResolution(this.__ptr, resolution)
  74. }
  75. BezierCurve.prototype.rebuildHeightCache = function() {
  76. Polycode.BezierCurve_rebuildHeightCache(this.__ptr)
  77. }
  78. BezierCurve.prototype.recalculateDistances = function() {
  79. Polycode.BezierCurve_recalculateDistances(this.__ptr)
  80. }