MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / RectF

Class RectF

Engine/source/math/mRect.h:77–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75};
76
77class RectF
78{
79 public:
80 Point2F point;
81 Point2F extent;
82
83 public:
84 RectF() { }
85 RectF(const Point2F& in_rMin,
86 const Point2F& in_rExtent);
87 RectF(const F32 in_left, const F32 in_top,
88 const F32 in_width, const F32 in_height);
89
90 void set(const Point2F& in_rMin, const Point2F& in_rExtent);
91 void set(const F32 in_left, const F32 in_top,
92 const F32 in_width, const F32 in_height);
93
94 void inset(F32 x, F32 y);
95
96 /// Return distance of the reference point to the rectangle.
97 F32 getDistanceToPoint( const Point2F &refPt ) const;
98
99 /// Return the squared distance of the reference point to the rectangle.
100 F32 getSqDistanceToPoint( const Point2F &refPt ) const;
101
102 bool intersect(const RectF& clipRect);
103 bool pointInRect(const Point2F& pt) const;
104 bool overlaps(const RectF&) const;
105 bool contains(const Point2F &p) const
106 {
107 Point2F minkowskiP = p - point;
108
109 // If we're beyond origin...
110 if(minkowskiP.x < 0 || minkowskiP.y < 0)
111 return false;
112
113 // Or past extent...
114 if(minkowskiP.x > extent.x || minkowskiP.y > extent.y)
115 return false;
116
117 // Otherwise we're ok.
118 return true;
119 }
120
121 bool contains(const RectF& R) const;
122
123 void unionRects( const RectF &rect );
124
125 F32 len_x() const;
126 F32 len_y() const;
127
128 bool isValidRect() const { return (extent.x > 0.0f && extent.y > 0.0f); }
129 inline bool intersectTriangle(const Point2F &a, const Point2F &b, const Point2F &c);
130
131};
132
133class RectD
134{

Callers 5

ConsoleSetTypeFunction · 0.70
drawBitmapStretchMethod · 0.50
drawBitmapSRMethod · 0.50
drawBitmapStretchSRMethod · 0.50
_findOrCreateBucketMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected