Point.d.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { MatrixArray } from './matrix';
  2. export interface PointLike {
  3. x: number;
  4. y: number;
  5. }
  6. export default class Point {
  7. x: number;
  8. y: number;
  9. constructor(x?: number, y?: number);
  10. copy(other: PointLike): this;
  11. clone(): Point;
  12. set(x: number, y: number): this;
  13. equal(other: PointLike): boolean;
  14. add(other: PointLike): this;
  15. scale(scalar: number): void;
  16. scaleAndAdd(other: PointLike, scalar: number): void;
  17. sub(other: PointLike): this;
  18. dot(other: PointLike): number;
  19. len(): number;
  20. lenSquare(): number;
  21. normalize(): this;
  22. distance(other: PointLike): number;
  23. distanceSquare(other: Point): number;
  24. negate(): this;
  25. transform(m: MatrixArray): this;
  26. toArray(out: number[]): number[];
  27. fromArray(input: number[]): void;
  28. static set(p: PointLike, x: number, y: number): void;
  29. static copy(p: PointLike, p2: PointLike): void;
  30. static len(p: PointLike): number;
  31. static lenSquare(p: PointLike): number;
  32. static dot(p0: PointLike, p1: PointLike): number;
  33. static add(out: PointLike, p0: PointLike, p1: PointLike): void;
  34. static sub(out: PointLike, p0: PointLike, p1: PointLike): void;
  35. static scale(out: PointLike, p0: PointLike, scalar: number): void;
  36. static scaleAndAdd(out: PointLike, p0: PointLike, p1: PointLike, scalar: number): void;
  37. static lerp(out: PointLike, p0: PointLike, p1: PointLike, t: number): void;
  38. }