RectangleF_2D.ts 754 B

1234567891011121314151617181920212223
  1. import {SizeF_2D} from "./SizeF_2D";
  2. import {PointF_2D} from "./PointF_2D";
  3. export class RectangleF_2D {
  4. public X: number;
  5. public Y: number;
  6. public Width: number;
  7. public Height: number;
  8. constructor(x: number, y: number, width: number, height: number) {
  9. this.X = x;
  10. this.Y = y;
  11. this.Width = width;
  12. this.Height = height;
  13. }
  14. public static createFromLocationAndSize(location: PointF_2D, size: SizeF_2D): RectangleF_2D {
  15. return new RectangleF_2D(location.X, location.Y, size.Width, size.Height);
  16. }
  17. public get Location(): PointF_2D {
  18. return new PointF_2D(this.X, this.Y);
  19. }
  20. public get Size(): SizeF_2D {
  21. return new SizeF_2D(this.Width, this.Height);
  22. }
  23. }