MCPcopy Create free account
hub / github.com/Kitware/VTK / AddRect

Function AddRect

Common/DataModel/vtkRect.h:189–227  ·  view source on GitHub ↗

@{ * Expand this rect to contain the rect passed in. */

Source from the content-addressed store, hash-verified

187 * Expand this rect to contain the rect passed in.
188 */
189 void AddRect(const vtkRect<T>& rect)
190 {
191 if (rect.GetX() < this->GetX())
192 {
193 T dx = this->GetX() - rect.GetX();
194 this->SetX(rect.GetX());
195 this->SetWidth(vtkMath::Max(dx + this->GetWidth(), rect.GetWidth()));
196 }
197 else if (rect.GetX() > this->GetX())
198 {
199 T dx = rect.GetX() - this->GetX();
200 // this->GetX() is already correct
201 this->SetWidth(vtkMath::Max(dx + rect.GetWidth(), this->GetWidth()));
202 }
203 else
204 {
205 // this->GetX() is already correct
206 this->SetWidth(vtkMath::Max(rect.GetWidth(), this->GetWidth()));
207 }
208 ///@}
209
210 if (rect.GetY() < this->GetY())
211 {
212 T dy = this->GetY() - rect.GetY();
213 this->SetY(rect.GetY());
214 this->SetHeight(vtkMath::Max(dy + this->GetHeight(), rect.GetHeight()));
215 }
216 else if (rect.GetY() > this->GetY())
217 {
218 T dy = rect.GetY() - this->GetY();
219 // this->GetY() is already correct
220 this->SetHeight(vtkMath::Max(dy + rect.GetHeight(), this->GetHeight()));
221 }
222 else
223 {
224 // this->GetY() is already correct
225 this->SetHeight(vtkMath::Max(rect.GetHeight(), this->GetHeight()));
226 }
227 }
228
229 /**
230 * Returns true if the rect argument overlaps this rect.

Callers

nothing calls this directly

Calls 8

MaxFunction · 0.70
GetXMethod · 0.45
SetXMethod · 0.45
SetWidthMethod · 0.45
GetWidthMethod · 0.45
SetYMethod · 0.45
SetHeightMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected