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

Function AddPoint

Common/DataModel/vtkRect.h:142–172  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

140 * Expand this rect to contain the point passed in.
141 */
142 void AddPoint(const T point[2])
143 {
144 // This code is written like this to ensure that adding a point gives
145 // exactly the same result as AddRect(vtkRect(x,y,0,0)
146 if (point[0] < this->GetX())
147 {
148 T dx = this->GetX() - point[0];
149 this->SetX(point[0]);
150 this->SetWidth(dx + this->GetWidth());
151 }
152 else if (point[0] > this->GetX())
153 {
154 // this->GetX() is already correct
155 T dx = point[0] - this->GetX();
156 this->SetWidth(vtkMath::Max(dx, this->GetWidth()));
157 }
158 ///@}
159
160 if (point[1] < this->GetY())
161 {
162 T dy = this->GetY() - point[1];
163 this->SetY(point[1]);
164 this->SetHeight(dy + this->GetHeight());
165 }
166 else if (point[1] > this->GetY())
167 {
168 // this->GetY() is already correct
169 T dy = point[1] - this->GetY();
170 this->SetHeight(vtkMath::Max(dy, this->GetHeight()));
171 }
172 }
173
174 ///@{
175 /**

Callers 1

Id AddPointMethod · 0.85

Calls 9

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

Tested by

no test coverage detected