usdrt::GfRect2i¶
Defined in usdrt/gf/rect.h
-
struct
usdrt
::
GfRect2i
¶ -
Public Functions
-
GfRect2i
() = default¶
-
inline constexpr
GfRect2i
(const GfVec2i &min, const GfVec2i &max)¶ Constructs a rectangle with
min
andmax
corners.
-
inline
GfRect2i
(const GfVec2i &min, int width, int height)¶ Constructs a rectangle with
min
corner and the indicatedwidth
andheight
.
-
inline bool
IsNull
() const¶ Returns true if the rectangle is a null rectangle.
A null rectangle has both the width and the height set to 0, that is
andGetMaxX() == GetMinX() - 1
Remember that ifGetMaxY() == GetMinY() - 1
GetMinX()
andGetMaxX()
return the same value then the rectangle has width 1, and similarly for the height.A null rectangle is both empty, and not valid.
-
inline bool
IsEmpty
() const¶ Returns true if the rectangle is empty.
An empty rectangle has one or both of its min coordinates strictly greater than the corresponding max coordinate.
An empty rectangle is not valid.
-
inline bool
IsValid
() const¶ Return true if the rectangle is valid (equivalently, not empty).
-
inline GfRect2i
GetNormalized
() const¶ Returns a normalized rectangle, i.e. one that has a non-negative width and height.
GetNormalized()
swaps the min and max x-coordinates to ensure a non-negative width, and similarly for the y-coordinates.
-
inline int
GetMinX
() const¶ Return the X value of min corner.
-
inline void
SetMinX
(int x)¶ Set the X value of the min corner.
-
inline int
GetMaxX
() const¶ Return the X value of the max corner.
-
inline void
SetMaxX
(int x)¶ Set the X value of the max corner.
-
inline int
GetMinY
() const¶ Return the Y value of the min corner.
-
inline void
SetMinY
(int y)¶ Set the Y value of the min corner.
-
inline int
GetMaxY
() const¶ Return the Y value of the max corner.
-
inline void
SetMaxY
(int y)¶ Set the Y value of the max corner.
-
inline unsigned long
GetArea
() const¶ Return the area of the rectangle.
-
inline int
GetWidth
() const¶ Returns the width of the rectangle.
Note
If the min and max x-coordinates are coincident, the width is one.
-
inline int
GetHeight
() const¶ Returns the height of the rectangle.
Note
If the min and max y-coordinates are coincident, the height is one.
-
inline GfRect2i
GetIntersection
(const GfRect2i &that) const¶ Computes the intersection of two rectangles.
-
inline GfRect2i
Intersect
(const GfRect2i &that) const¶ Computes the intersection of two rectangles.
- Deprecated:
Use GetIntersection() instead
-
inline GfRect2i
Union
(const GfRect2i &that) const¶ Computes the union of two rectangles.
- Deprecated:
Use GetUnion() instead.
Public Static Attributes
-
static const size_t
dimension
= MinMaxType::dimension¶
-