Advertisement
_code_feedback_

Task 1: AA_Rectangle.h

Apr 2nd, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.09 KB | None | 0 0
  1. /*
  2.     File: AA_Rectangle.h
  3.  
  4.     Author: *REDACTED*
  5.  
  6.     Created: *REDACTED*
  7.  
  8.     Desc: File containing the class definition for Axis Aligned Rectangles (AA_Rectangle),
  9.         capable of testing whether a point exists within the rectangle,
  10.         as well as whether the rectangle intersects of overlaps with another rectangle
  11. */
  12.  
  13. #pragma once
  14. #include "Point2D.h"
  15.  
  16. class AA_Rectangle
  17. {
  18. public:
  19.     // Default constructor
  20.     AA_Rectangle();
  21.  
  22.     // Parameterized constructor(s)
  23.     AA_Rectangle(Point2D * origin, float width, float height);
  24.     AA_Rectangle(float xOrigin, float yOrigin, float width, float height);
  25.  
  26.     // Copy constructor
  27.     AA_Rectangle(const AA_Rectangle& other);
  28.  
  29.     // Assignment operator
  30.     void operator=(const AA_Rectangle & other);
  31.  
  32.     // Destructor
  33.     ~AA_Rectangle();
  34.  
  35.     // Check if a given reference point lies within the rectangle
  36.     bool isPointInRectangle(Point2D *refPoint);
  37.  
  38.     // Check if a given reference AA_Rectangle intersects this rectangle
  39.     bool isRectangleIntersecting(AA_Rectangle *refRectangle);
  40.  
  41.     Point2D *mBottomLeft;
  42.     Point2D *mTopRight;
  43.  
  44.     float mWidth;
  45.     float mHeight;
  46. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement