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

Method BuildMinorTicks

Rendering/Annotation/vtkAxisActor.cxx:2014–2126  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2012
2013//------------------------------------------------------------------------------
2014void vtkAxisActor::BuildMinorTicks(double p1[3], double p2[3], double localCoordSys[3][3])
2015{
2016 // (p2 - p1) vector
2017 double deltaVector[3];
2018
2019 // inside point: point shifted toward x,y,z direction
2020 // outside points: point shifted toward -x,-y,-z direction
2021 double vPointInside[3], vPointOutside[3], uPointInside[3], uPointOutside[3];
2022
2023 int uMult = vtkAxisActorMultiplierTable1[this->AxisPosition];
2024 int vMult = vtkAxisActorMultiplierTable2[this->AxisPosition];
2025
2026 double* axisVector = localCoordSys[0];
2027 double* uVector = localCoordSys[1];
2028 double* vVector = localCoordSys[2];
2029
2030 // - Initialize all points to be on the axis
2031 for (int i = 0; i < 3; i++)
2032 {
2033 uPointInside[i] = vPointInside[i] = uPointOutside[i] = vPointOutside[i] = p1[i];
2034 deltaVector[i] = (p2[i] - p1[i]);
2035 }
2036
2037 double axisLength = vtkMath::Norm(deltaVector);
2038 double rangeScale = axisLength / (this->Range[1] - this->Range[0]);
2039
2040 // - Move outside points if needed (Axis -> Outside)
2041 if (this->TickLocation == VTK_TICKS_OUTSIDE || this->TickLocation == VTK_TICKS_BOTH)
2042 {
2043 for (int i = 0; i < 3; i++)
2044 {
2045 uPointOutside[i] += uVector[i] * uMult * this->MinorTickSize;
2046 vPointOutside[i] += vVector[i] * vMult * this->MinorTickSize;
2047 }
2048 }
2049
2050 // - Move inside points if needed (Axis -> Inside)
2051 if (this->TickLocation == VTK_TICKS_INSIDE || this->TickLocation == VTK_TICKS_BOTH)
2052 {
2053 for (int i = 0; i < 3; i++)
2054 {
2055 uPointInside[i] -= uVector[i] * uMult * this->MinorTickSize;
2056 vPointInside[i] -= vVector[i] * vMult * this->MinorTickSize;
2057 }
2058 }
2059
2060 // - Add the initial shift if any
2061 double axisShift = (this->MinorRangeStart - this->Range[0]) * rangeScale;
2062 axisLength -= axisShift;
2063 for (int i = 0; i < 3; i++)
2064 {
2065 uPointInside[i] += axisVector[i] * axisShift;
2066 vPointInside[i] += axisVector[i] * axisShift;
2067 uPointOutside[i] += axisVector[i] * axisShift;
2068 vPointOutside[i] += axisVector[i] * axisShift;
2069 }
2070
2071 // - Reduce the deltaVector to correspond to a tick step

Callers 1

BuildTickPointsMethod · 0.95

Calls 4

isfiniteFunction · 0.85
NormFunction · 0.50
NormalizeFunction · 0.50
InsertNextPointMethod · 0.45

Tested by

no test coverage detected