halton2DSequence.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * Class for generating 2D Halton sequences.
  3. * From https://observablehq.com/@jrus/halton
  4. */
  5. export declare class Halton2DSequence {
  6. private _curIndex;
  7. private _sequence;
  8. private _numSamples;
  9. private _width;
  10. private _height;
  11. private _baseX;
  12. private _baseY;
  13. /**
  14. * The x coordinate of the current sample.
  15. */
  16. readonly x = 0;
  17. /**
  18. * The y coordinate of the current sample.
  19. */
  20. readonly y = 0;
  21. /**
  22. * Creates a new Halton2DSequence.
  23. * @param numSamples Number of samples in the sequence.
  24. * @param baseX The base for the x coordinate (default: 2).
  25. * @param baseY The base for the y coordinate (default: 3).
  26. * @param width Factor to scale the x coordinate by (default: 1). The scaling factor is 1/width.
  27. * @param height Factor to scale the y coordinate by (default: 1). The scaling factor is 1/height.
  28. */
  29. constructor(numSamples: number, baseX?: number, baseY?: number, width?: number, height?: number);
  30. /**
  31. * Regenerates the sequence with a new number of samples.
  32. * @param numSamples Number of samples in the sequence.
  33. */
  34. regenerate(numSamples: number): void;
  35. /**
  36. * Sets the dimensions of the sequence.
  37. * @param width Factor to scale the x coordinate by. The scaling factor is 1/width.
  38. * @param height Factor to scale the y coordinate by. The scaling factor is 1/height.
  39. */
  40. setDimensions(width: number, height: number): void;
  41. /**
  42. * Advances to the next sample in the sequence.
  43. */
  44. next(): void;
  45. private _generateSequence;
  46. private _halton;
  47. }