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

Method UpdateTransform

Common/DataModel/vtkCone.cxx:118–138  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

116
117//----------------------------------------------------------------------------
118void vtkCone::UpdateTransform()
119{
120 // vtkCone is aligned to the x-axis. Setup a transform that rotates
121 // <1, 0, 0> to the vector in Axis and translates according to origin
122 const vtkVector3d xAxis(1., 0., 0.);
123 vtkVector3d axis(this->Axis);
124
125 vtkVector3d cross = xAxis.Cross(axis);
126 double crossNorm = cross.Normalize();
127 double dot = xAxis.Dot(axis);
128 double angle = vtkMath::DegreesFromRadians(std::atan2(crossNorm, dot));
129
130 vtkNew<vtkTransform> xform;
131 xform->Identity();
132 xform->Translate(this->Origin);
133 xform->RotateWXYZ(angle, cross.GetData());
134 xform->Inverse();
135
136 this->SetTransform(xform.GetPointer());
137 this->Modified();
138}
139VTK_ABI_NAMESPACE_END

Callers 1

SetOriginMethod · 0.95

Calls 11

RotateWXYZMethod · 0.80
CrossMethod · 0.45
NormalizeMethod · 0.45
DotMethod · 0.45
IdentityMethod · 0.45
TranslateMethod · 0.45
GetDataMethod · 0.45
InverseMethod · 0.45
SetTransformMethod · 0.45
GetPointerMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected