BezierCurve.js 3.4 KB

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