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

Method GetRotationMatrix

Filters/General/vtkAxisAlignedTransformFilter.cxx:299–354  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

297
298//------------------------------------------------------------------------------
299void vtkAxisAlignedTransformFilter::GetRotationMatrix(
300 int axis, int rotation, int rotationMatrix[3][3])
301{
302 int cosTheta = 0, sinTheta = 0;
303 switch (rotation)
304 {
305 case ROT0:
306 default:
307 cosTheta = 1;
308 sinTheta = 0;
309 break;
310
311 case ROT90:
312 cosTheta = 0;
313 sinTheta = 1;
314 break;
315
316 case ROT180:
317 cosTheta = -1;
318 sinTheta = 0;
319 break;
320
321 case ROT270:
322 cosTheta = 0;
323 sinTheta = -1;
324 break;
325 }
326
327 int I[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
328 std::memcpy(rotationMatrix, I, 9 * sizeof(int));
329
330 switch (axis)
331 {
332 case Axis::X:
333 default:
334 rotationMatrix[1][1] = cosTheta;
335 rotationMatrix[1][2] = -sinTheta;
336 rotationMatrix[2][1] = sinTheta;
337 rotationMatrix[2][2] = cosTheta;
338 break;
339
340 case Axis::Y:
341 rotationMatrix[0][0] = cosTheta;
342 rotationMatrix[0][2] = sinTheta;
343 rotationMatrix[2][0] = -sinTheta;
344 rotationMatrix[2][2] = cosTheta;
345 break;
346
347 case Axis::Z:
348 rotationMatrix[0][0] = cosTheta;
349 rotationMatrix[0][1] = -sinTheta;
350 rotationMatrix[1][0] = sinTheta;
351 rotationMatrix[1][1] = cosTheta;
352 break;
353 }
354}
355
356//------------------------------------------------------------------------------

Callers 1

DispatchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected