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

Method EvaluateFunction

Common/DataModel/vtkCylinder.cxx:24–38  ·  view source on GitHub ↗

------------------------------------------------------------------------------ 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.

Source from the content-addressed store, hash-verified

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.
24double 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

Callers

nothing calls this directly

Calls 1

DotFunction · 0.70

Tested by

no test coverage detected