math.isovector.d.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { Vector3 } from "./math.vector";
  2. /**
  3. * Class representing an isovector a vector containing 2 INTEGER coordinates
  4. * x axis is horizontal
  5. * y axis is 60 deg counter clockwise from positive y axis
  6. * @internal
  7. */
  8. export declare class _IsoVector {
  9. /** defines the first coordinate */
  10. x: number;
  11. /** defines the second coordinate */
  12. y: number;
  13. /**
  14. * Creates a new isovector from the given x and y coordinates
  15. * @param x defines the first coordinate, must be an integer
  16. * @param y defines the second coordinate, must be an integer
  17. */
  18. constructor(
  19. /** defines the first coordinate */
  20. x?: number,
  21. /** defines the second coordinate */
  22. y?: number);
  23. /**
  24. * Gets a new IsoVector copied from the IsoVector
  25. * @returns a new IsoVector
  26. */
  27. clone(): _IsoVector;
  28. /**
  29. * Rotates one IsoVector 60 degrees counter clockwise about another
  30. * Please note that this is an in place operation
  31. * @param other an IsoVector a center of rotation
  32. * @returns the rotated IsoVector
  33. */
  34. rotate60About(other: _IsoVector): this;
  35. /**
  36. * Rotates one IsoVector 60 degrees clockwise about another
  37. * Please note that this is an in place operation
  38. * @param other an IsoVector as center of rotation
  39. * @returns the rotated IsoVector
  40. */
  41. rotateNeg60About(other: _IsoVector): this;
  42. /**
  43. * For an equilateral triangle OAB with O at isovector (0, 0) and A at isovector (m, n)
  44. * Rotates one IsoVector 120 degrees counter clockwise about the center of the triangle
  45. * Please note that this is an in place operation
  46. * @param m integer a measure a Primary triangle of order (m, n) m > n
  47. * @param n >= 0 integer a measure for a Primary triangle of order (m, n)
  48. * @returns the rotated IsoVector
  49. */
  50. rotate120(m: number, n: number): this;
  51. /**
  52. * For an equilateral triangle OAB with O at isovector (0, 0) and A at isovector (m, n)
  53. * Rotates one IsoVector 120 degrees clockwise about the center of the triangle
  54. * Please note that this is an in place operation
  55. * @param m integer a measure a Primary triangle of order (m, n) m > n
  56. * @param n >= 0 integer a measure for a Primary triangle of order (m, n)
  57. * @returns the rotated IsoVector
  58. */
  59. rotateNeg120(m: number, n: number): this;
  60. /**
  61. * Transforms an IsoVector to one in Cartesian 3D space based on an isovector
  62. * @param origin an IsoVector
  63. * @param isoGridSize
  64. * @returns Point as a Vector3
  65. */
  66. toCartesianOrigin(origin: _IsoVector, isoGridSize: number): Vector3;
  67. /**
  68. * Gets a new IsoVector(0, 0)
  69. * @returns a new IsoVector
  70. */
  71. static Zero(): _IsoVector;
  72. }