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

Method RotateCorners

Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx:543–570  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

541
542//------------------------------------------------------------------------------
543void vtkMatplotlibMathTextUtilities::RotateCorners(
544 double angleDeg, double corners[4][2], double bbox[4])
545{
546 double angleRad = vtkMath::RadiansFromDegrees(angleDeg);
547 double c = cos(angleRad);
548 double s = sin(angleRad);
549 // Rotate corners
550 for (int i = 0; i < 4; ++i)
551 {
552 int newpt[2];
553 newpt[0] = c * corners[i][0] - s * corners[i][1];
554 newpt[1] = s * corners[i][0] + c * corners[i][1];
555 corners[i][0] = newpt[0];
556 corners[i][1] = newpt[1];
557 }
558 // Find new bounds
559 bbox[0] = VTK_INT_MAX;
560 bbox[1] = VTK_INT_MIN;
561 bbox[2] = VTK_INT_MAX;
562 bbox[3] = VTK_INT_MIN;
563 for (int i = 0; i < 4; ++i)
564 {
565 bbox[0] = std::min(corners[i][0], bbox[0]);
566 bbox[1] = std::max(corners[i][0], bbox[1]);
567 bbox[2] = std::min(corners[i][1], bbox[2]);
568 bbox[3] = std::max(corners[i][1], bbox[3]);
569 }
570}
571
572//------------------------------------------------------------------------------
573// This is more or less ported from vtkFreeTypeTools.

Callers 2

GetMetricsMethod · 0.95
RenderStringMethod · 0.95

Calls 4

cosFunction · 0.50
sinFunction · 0.50
minFunction · 0.50
maxFunction · 0.50

Tested by

no test coverage detected