------------------------------------------------------------------------------ Evaluate cylinder equation F(x,y,z) along specified Axis. Note that this is basically a distance to line computation, compared to the cylinder radius.
| 22 | // Evaluate cylinder equation F(x,y,z) along specified Axis. Note that this is |
| 23 | // basically a distance to line computation, compared to the cylinder radius. |
| 24 | double vtkCylinder::EvaluateFunction(double x[3]) |
| 25 | { |
| 26 | // Determine distance^2 of point to axis. Note that cylinder Axis is |
| 27 | // always normalized and always non-zero. |
| 28 | double x2C[3]; |
| 29 | x2C[0] = x[0] - this->Center[0]; |
| 30 | x2C[1] = x[1] - this->Center[1]; |
| 31 | x2C[2] = x[2] - this->Center[2]; |
| 32 | |
| 33 | // projection onto cylinder axis |
| 34 | double proj = vtkMath::Dot(this->Axis, x2C); |
| 35 | |
| 36 | // return distance^2 - R^2 |
| 37 | return ((vtkMath::Dot(x2C, x2C) - proj * proj) - this->Radius * this->Radius); |
| 38 | } |
| 39 | |
| 40 | //------------------------------------------------------------------------------ |
| 41 | // Evaluate cylinder function gradient (along potentially oriented axis). The |