------------------------------------------------------------------------------ Set the center of the plane. Will modify the Origin, Point1, and Point2 instance variables as necessary (i.e., translate the plane).
| 251 | // Set the center of the plane. Will modify the Origin, Point1, and Point2 |
| 252 | // instance variables as necessary (i.e., translate the plane). |
| 253 | void vtkPlaneSource::SetCenter(double center[3]) |
| 254 | { |
| 255 | if (this->Center[0] == center[0] && this->Center[1] == center[1] && this->Center[2] == center[2]) |
| 256 | { |
| 257 | return; // no change |
| 258 | } |
| 259 | else |
| 260 | { |
| 261 | int i; |
| 262 | double v1[3], v2[3]; |
| 263 | |
| 264 | for (i = 0; i < 3; i++) |
| 265 | { |
| 266 | v1[i] = this->Point1[i] - this->Origin[i]; |
| 267 | v2[i] = this->Point2[i] - this->Origin[i]; |
| 268 | } |
| 269 | |
| 270 | for (i = 0; i < 3; i++) |
| 271 | { |
| 272 | this->Center[i] = center[i]; |
| 273 | this->Origin[i] = this->Center[i] - 0.5 * (v1[i] + v2[i]); |
| 274 | this->Point1[i] = this->Origin[i] + v1[i]; |
| 275 | this->Point2[i] = this->Origin[i] + v2[i]; |
| 276 | } |
| 277 | this->Modified(); |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | //------------------------------------------------------------------------------ |
| 282 | // Set the center of the plane. Will modify the Origin, Point1, and Point2 |