Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
hdi::core::Rect Class Reference

Contains Point and Size objects to describe a rectangle that exists at a specific point of given dimensions. More...

#include <hdicoreRect.h>

Collaboration diagram for hdi::core::Rect:
Collaboration graph
[legend]

Public Member Functions

 Rect ()
 Default Rect constructor; calls the default constructors for the origin and size.
 
 Rect (const double x_, const double y_, const double width_, const double height_)
 Constructs a Rect from an (x,y) point for the top-left and a width and height.
 
 Rect (const Point &pt_, const Size &size_)
 Rect constructor, taking Point and Size arguments.
 
 Rect (const Rect &rect_)
 Rect copy constructor.
 
virtual ~Rect ()
 Rect destructor.
 
virtual Rectoperator= (const Rect &rhs_)
 Sets a Rect object from another Rect object.
 
virtual bool operator== (const Rect &rhs_) const
 Tests whether a given Rect object is the same as another.
 
virtual bool operator!= (const Rect &rhs_) const
 Tests whether a given Rect object is not the same as another.
 
virtual Rect operator+ (const Rect &rhs_) const
 Allows two rects to have their origin and size objects added using the + operator.
 
virtual Rectoperator+= (const Rect &rhs_)
 Allows two rects to have their origin and size objects added and assigned using the += operator.
 
virtual Rect operator- (const Rect &rhs_) const
 Allows two rects to have their origin and size objects subtracted using the - operator.
 
virtual Rectoperator-= (const Rect &rhs_)
 Allows two rects to have their origin and size objects subtracted and assigned using the -= operator.
 
virtual void offset (const double tx_, const double ty_)
 Offsets a rect along the x- and y-axes by given amounts.
 
virtual void resize (const double w_, const double h_)
 Resizes a rect to a given width and height.
 
virtual Rect inset (const double x_, const double y_) const
 Insets a rect by given amounts on the x- and y-axes (or expands if negative)
 
virtual Point topLeft () const
 Gets the top-left point of the rect.
 
virtual Point topCenter () const
 Gets the top-center point of the rect.
 
virtual Point topRight () const
 Gets the top-right point of the rect.
 
virtual Point midLeft () const
 Gets the mid-left point of the rect.
 
virtual Point midCenter () const
 Gets the mid-center point of the rect.
 
virtual Point midRight () const
 Gets the mid-right point of the rect.
 
virtual Point bottomLeft () const
 Gets the bottom-left point of the rect.
 
virtual Point bottomCenter () const
 Gets the bottom-center point of the rect.
 
virtual Point bottomRight () const
 Gets the bottom-right point of the rect.
 
virtual Point pointFromPinPoint (const BoundsPinPointType pinPt_) const
 Gets a "pin point" from the rect bounds.
 
virtual double left () const
 Gets the position of the left bounding edge of the rectangle along the x-axis.
 
virtual double top () const
 Gets the position of the top bounding edge of the rectangle along the y-axis.
 
virtual double right () const
 Gets the position of the right bounding edge of the rectangle along the x-axis.
 
virtual double bottom () const
 Gets the position of the bottom bounding edge of the rectangle along the y-axis.
 
virtual void setLeft (const double left_)
 Sets the position of the left bounding edge of the rectangle along the x-axis.
 
virtual void setTop (const double top_)
 Sets the position of the top bounding edge of the rectangle along the y-axis.
 
virtual void setRight (const double right_)
 Sets the position of the right bounding edge of the rectangle along the x-axis.
 
virtual void setBottom (const double bottom_)
 Sets the position of the bottom bounding edge of the rectangle along the y-axis.
 
virtual double area () const
 Gets the area of the rect.
 
virtual double perimeter () const
 Gets the perimeter of the rect.
 
virtual bool containsPoint (const Point &pt_) const
 Gets whether a given point lies inside the target rect.
 
virtual bool overlaps (const Rect &rect2_) const
 Checks whether the target rect overlaps a given rect.
 
virtual bool enclosePoint (const Point &pt_)
 Enlarges the target rect, if necessary, to enclose a given point.
 
virtual Rect unionRects (const Rect &rect2_) const
 Unions two rects, forming a rect that has bounds sufficient to enclose both initial rects.
 
virtual Rect scale (const double xScaler_, const double yScaler_) const
 Scales the width and height of a rect by given amounts on the x- and y- axes.
 
virtual bool intersection (const Rect &rect2_, Rect &iRect__) const
 Gets the intersection between two rects.
 
virtual void enclosingEllipse (double &width__, double &height__) const
 Gets the width and height of an ellipse that would enclose the rect.
 
virtual RectLineIntersectionType lineIntersectionPoints (const Point &a_, const Point &b_, Point &iPt1__, Point &iPt2__) const
 Finds the intersection points on a rectangle that a line has with it.
 
virtual RectLineIntersectionType lineIntersectionPoints (const Point &a_, const Point &b_, const Angle &angle_, Point &iPt1__, Point &iPt2__) const
 Finds the intersection points on a rectangle, were it rotated, that a line has with it.
 

Public Attributes

Point origin
 Origin point for the rect (top-left, when size.width and size.height are positive)
 
Size size
 Dimensions of the rect.
 

Friends

aip::Rect * __accessImpl (const Rect &)
 
Rect __accessCtor (const aip::Rect &)
 

Detailed Description

Contains Point and Size objects to describe a rectangle that exists at a specific point of given dimensions.

Constructor & Destructor Documentation

◆ Rect() [1/4]

hdi::core::Rect::Rect ( )

Default Rect constructor; calls the default constructors for the origin and size.

Author
GW
Date
08/2013

◆ Rect() [2/4]

hdi::core::Rect::Rect ( const double  x_,
const double  y_,
const double  width_,
const double  height_ 
)

Constructs a Rect from an (x,y) point for the top-left and a width and height.

Author
GW
Date
08/2013
Parameters
x_Position of the left of the rect along the x-axis
y_Position of the top of the rect along the y-axis
width_Width of the rect
height_Height of the rect

◆ Rect() [3/4]

hdi::core::Rect::Rect ( const Point pt_,
const Size size_ 
)

Rect constructor, taking Point and Size arguments.

Author
GW
Date
08/2013
Parameters
pt_(x,y) point of the rect (top-left)
size_Dimensions of the rect

◆ Rect() [4/4]

hdi::core::Rect::Rect ( const Rect rect_)

Rect copy constructor.

Author
GW
Date
08/2013
Parameters
rect_Existing Rect to copy

◆ ~Rect()

virtual hdi::core::Rect::~Rect ( )
virtual

Rect destructor.

Author
GW
Date
08/2013

Member Function Documentation

◆ area()

virtual double hdi::core::Rect::area ( ) const
virtual

Gets the area of the rect.

Author
GW
Date
08/2013
Returns
The area of the rect
Note
The value returned will always be positive

◆ bottom()

virtual double hdi::core::Rect::bottom ( ) const
virtual

Gets the position of the bottom bounding edge of the rectangle along the y-axis.

Author
GW
Date
08/2013
Returns
The position of the bottom side of the rectangle

◆ bottomCenter()

virtual Point hdi::core::Rect::bottomCenter ( ) const
virtual

Gets the bottom-center point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the bottom-center of the rect
Note
The point returned may not be the geometric bottom-center of the rect in the case of a negative width and/or height

◆ bottomLeft()

virtual Point hdi::core::Rect::bottomLeft ( ) const
virtual

Gets the bottom-left point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the bottom-left of the rect
Note
The point returned may not be the geometric bottom-left of the rect in the case of a negative width and/or height

◆ bottomRight()

virtual Point hdi::core::Rect::bottomRight ( ) const
virtual

Gets the bottom-right point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the bottom-right of the rect
Note
The point returned may not be the geometric bottom-right of the rect in the case of a negative width and/or height

◆ containsPoint()

virtual bool hdi::core::Rect::containsPoint ( const Point pt_) const
virtual

Gets whether a given point lies inside the target rect.

Author
GW
Date
08/2013
Parameters
pt_Point to test
Returns
true if the point is within the bounds of the rect, false otherwise

◆ enclosePoint()

virtual bool hdi::core::Rect::enclosePoint ( const Point pt_)
virtual

Enlarges the target rect, if necessary, to enclose a given point.

Author
GW
Date
08/2013
Parameters
pt_Point the rect should enclose
Returns
true if the rect was enlarged, false otherwise

◆ enclosingEllipse()

virtual void hdi::core::Rect::enclosingEllipse ( double &  width__,
double &  height__ 
) const
virtual

Gets the width and height of an ellipse that would enclose the rect.

Author
GW
Date
06/2018
Parameters
width__Return-by-reference for the ellipse width
height__Return-by-reference for the ellipse height
Note
The ellipse will have the same proportions as the rect

◆ inset()

virtual Rect hdi::core::Rect::inset ( const double  x_,
const double  y_ 
) const
virtual

Insets a rect by given amounts on the x- and y-axes (or expands if negative)

Author
GW
Date
08/2013
Parameters
x_Amount to inset the rect on the left and right sides
y_Amount to inset the rect on the top and bottom sides
Returns
A copy of the target Rect, with its origin and size updated to reflect the provided inset
Note
Positive values cause an inset, while negative values cause an "outset" (expansion)

◆ intersection()

virtual bool hdi::core::Rect::intersection ( const Rect rect2_,
Rect iRect__ 
) const
virtual

Gets the intersection between two rects.

Author
GW
Date
08/2013
Parameters
rect2_Second rect to test for an intersection with the target rect
iRect__Return-by-reference for the intersection rect
Returns
true if an intersection exists, false otherwise
Note
iRect__ will be the rect that describes the intersecting area between rect2_ and the target rect.

◆ left()

virtual double hdi::core::Rect::left ( ) const
virtual

Gets the position of the left bounding edge of the rectangle along the x-axis.

Author
GW
Date
08/2013
Returns
The position of the left side of the rectangle

◆ lineIntersectionPoints() [1/2]

virtual RectLineIntersectionType hdi::core::Rect::lineIntersectionPoints ( const Point a_,
const Point b_,
const Angle angle_,
Point iPt1__,
Point iPt2__ 
) const
virtual

Finds the intersection points on a rectangle, were it rotated, that a line has with it.

Author
GW
Date
08/2013
Parameters
a_Start point for the line
b_End point for the line
angle_Amount the rectangle is rotated
iPt1__Return-by-reference for the first intersection point found
iPt2__Return-by-reference for the second intersection point found
Returns
An enum describing which intersection points were found, if any
Note
For reference, this function always checks clockwise from the left of the rectangle.

◆ lineIntersectionPoints() [2/2]

virtual RectLineIntersectionType hdi::core::Rect::lineIntersectionPoints ( const Point a_,
const Point b_,
Point iPt1__,
Point iPt2__ 
) const
virtual

Finds the intersection points on a rectangle that a line has with it.

Author
GW
Date
08/2013
Parameters
a_Start point for the line
b_End point for the line
iPt1__Return-by-reference for the first intersection point found
iPt2__Return-by-reference for the second intersection point found
Returns
An enum describing which intersection points were found, if any
Note
For reference, this function always checks clockwise from the left of the rectangle.

◆ midCenter()

virtual Point hdi::core::Rect::midCenter ( ) const
virtual

Gets the mid-center point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the mid-center of the rect

◆ midLeft()

virtual Point hdi::core::Rect::midLeft ( ) const
virtual

Gets the mid-left point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the mid-left of the rect
Note
The point returned may not be the geometric mid-left of the rect in the case of a negative width and/or height

◆ midRight()

virtual Point hdi::core::Rect::midRight ( ) const
virtual

Gets the mid-right point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the mid-right of the rect
Note
The point returned may not be the geometric mid-right of the rect in the case of a negative width and/or height

◆ offset()

virtual void hdi::core::Rect::offset ( const double  tx_,
const double  ty_ 
)
virtual

Offsets a rect along the x- and y-axes by given amounts.

This is a convenience method to adjust both the x and y values in one call

Author
GW
Date
08/2013
Parameters
tx_Amount to offset along the x-axis
ty_Amount to offset along the y-axis
Note
Negative values go toward 0.0 if the object to be transformed has a positive x and/or y value; positive values go away from 0.0

◆ operator!=()

virtual bool hdi::core::Rect::operator!= ( const Rect rhs_) const
virtual

Tests whether a given Rect object is not the same as another.

Author
GW
Date
08/2013
Parameters
rhs_Rect to compare against (righthand side of inequality operator)
Returns
true for the target and rhs_ being different rects, false otherwise

◆ operator+()

virtual Rect hdi::core::Rect::operator+ ( const Rect rhs_) const
virtual

Allows two rects to have their origin and size objects added using the + operator.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the + operator
Returns
A copy of the target ArtboardPoint, with all x and y values summed together

◆ operator+=()

virtual Rect & hdi::core::Rect::operator+= ( const Rect rhs_)
virtual

Allows two rects to have their origin and size objects added and assigned using the += operator.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the += operator
Returns
The lefthand side of the += operator, with all origin and size objects summed together

◆ operator-()

virtual Rect hdi::core::Rect::operator- ( const Rect rhs_) const
virtual

Allows two rects to have their origin and size objects subtracted using the - operator.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the - operator
Returns
A copy of the target ArtboardPoint, with rhs_ origin and size objects subtracted from this origin and size objects

◆ operator-=()

virtual Rect & hdi::core::Rect::operator-= ( const Rect rhs_)
virtual

Allows two rects to have their origin and size objects subtracted and assigned using the -= operator.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the -= operator
Returns
The lefthand side of the -= operator, with rhs_ origin and size objects subtracted from this origin and size objects

◆ operator=()

virtual Rect & hdi::core::Rect::operator= ( const Rect rhs_)
virtual

Sets a Rect object from another Rect object.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the = operator; Rect object to pull values from
Returns
The target ArtboardRect (lefthand side of the = operator) with its values updated

◆ operator==()

virtual bool hdi::core::Rect::operator== ( const Rect rhs_) const
virtual

Tests whether a given Rect object is the same as another.

Author
GW
Date
08/2013
Parameters
rhs_Rect to compare against (righthand side of equality operator)
Returns
true for the target and rhs_ being the same rect, false otherwise

◆ overlaps()

virtual bool hdi::core::Rect::overlaps ( const Rect rect2_) const
virtual

Checks whether the target rect overlaps a given rect.

Author
GW
Date
08/2013
Parameters
rect2_Rect to compare against for overlapping boundaries
Returns
true if the target rect and the provided rect overlap

◆ perimeter()

virtual double hdi::core::Rect::perimeter ( ) const
virtual

Gets the perimeter of the rect.

Author
GW
Date
08/2013
Returns
The perimeter of the rect

◆ pointFromPinPoint()

virtual Point hdi::core::Rect::pointFromPinPoint ( const BoundsPinPointType  pinPt_) const
virtual

Gets a "pin point" from the rect bounds.

Author
GW
Date
06/2018
Parameters
pinPt_Pin point which will be turned into an absolute point from the rect
Returns
A Point object for the given pin point

◆ resize()

virtual void hdi::core::Rect::resize ( const double  w_,
const double  h_ 
)
virtual

Resizes a rect to a given width and height.

This is a convenience method to set both width and height in one call

Author
GW
Date
08/2013
Parameters
w_New rect width
h_New rect height

◆ right()

virtual double hdi::core::Rect::right ( ) const
virtual

Gets the position of the right bounding edge of the rectangle along the x-axis.

Author
GW
Date
08/2013
Returns
The position of the right side of the rectangle

◆ scale()

virtual Rect hdi::core::Rect::scale ( const double  xScaler_,
const double  yScaler_ 
) const
virtual

Scales the width and height of a rect by given amounts on the x- and y- axes.

Author
GW
Date
08/2013
Parameters
xScaler_Multiplier for scaling horizontally (e.g. 0.75 is 75% of the current size)
yScaler_Multiplier for scaling vertically (e.g. 0.75 is 75% of the current size)
Returns
A copy of the target ArtboardRect that is scaled as specified

◆ setBottom()

virtual void hdi::core::Rect::setBottom ( const double  bottom_)
virtual

Sets the position of the bottom bounding edge of the rectangle along the y-axis.

Author
GW
Date
08/2013
Parameters
bottom_New bottom edge of the rect
Note
The top edge will be unaffected

◆ setLeft()

virtual void hdi::core::Rect::setLeft ( const double  left_)
virtual

Sets the position of the left bounding edge of the rectangle along the x-axis.

Author
GW
Date
08/2013
Parameters
left_New left edge of the rect
Note
The right edge will be unaffected (e.g. the width will automatically be adjusted such that the right bounding edge stays at the same position)

◆ setRight()

virtual void hdi::core::Rect::setRight ( const double  right_)
virtual

Sets the position of the right bounding edge of the rectangle along the x-axis.

Author
GW
Date
08/2013
Parameters
right_New right edge of the rect
Note
The left edge will be unaffected

◆ setTop()

virtual void hdi::core::Rect::setTop ( const double  top_)
virtual

Sets the position of the top bounding edge of the rectangle along the y-axis.

Author
GW
Date
08/2013
Parameters
top_New top edge of the rect
Note
The bottom edge will be unaffected (e.g. the height will automatically be adjusted such that the bottom bounding edge stays at the same position)

◆ top()

virtual double hdi::core::Rect::top ( ) const
virtual

Gets the position of the top bounding edge of the rectangle along the y-axis.

Author
GW
Date
08/2013
Returns
The position of the top side of the rectangle

◆ topCenter()

virtual Point hdi::core::Rect::topCenter ( ) const
virtual

Gets the top-center point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the top-center of the rect
Note
The point returned may not be the geometric top-center of the rect in the case of a negative width and/or height

◆ topLeft()

virtual Point hdi::core::Rect::topLeft ( ) const
virtual

Gets the top-left point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the top-left of the rect
Note
The point returned may not be the geometric top-left of the rect in the case of a negative width and/or height

◆ topRight()

virtual Point hdi::core::Rect::topRight ( ) const
virtual

Gets the top-right point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the top-right of the rect
Note
The point returned may not be the geometric top-right of the rect in the case of a negative width and/or height

◆ unionRects()

virtual Rect hdi::core::Rect::unionRects ( const Rect rect2_) const
virtual

Unions two rects, forming a rect that has bounds sufficient to enclose both initial rects.

Author
GW
Date
08/2013
Parameters
rect2_Second rect to consider in the union
Returns
A new ArtboardRect large enough to enclose both the target rect and rect2_