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

Method BuildMinorTicksLog

Rendering/Annotation/vtkAxisActor.cxx:2248–2371  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2246
2247//------------------------------------------------------------------------------
2248void vtkAxisActor::BuildMinorTicksLog(double p1[3], double p2[3], double localCoordSys[3][3])
2249{
2250 double deltaVector[3];
2251
2252 double* axisVector = localCoordSys[0];
2253 double* uVector = localCoordSys[1];
2254 double* vVector = localCoordSys[2];
2255
2256 // inside point: point shifted toward x,y,z direction
2257 // outside points: point shifted toward -x,-y,-z direction
2258 double uPointInside[3], vPointInside[3], uPointOutside[3], vPointOutside[3];
2259
2260 for (int i = 0; i < 3; i++)
2261 {
2262 uPointInside[i] = vPointInside[i] = uPointOutside[i] = vPointOutside[i] = p1[i];
2263 deltaVector[i] = (p2[i] - p1[i]);
2264 }
2265
2266 double axisLength = vtkMath::Norm(deltaVector);
2267
2268 // factor of conversion world coord <-> range
2269 double rangeScale = axisLength / log10(this->Range[1] / this->Range[0]);
2270
2271 vtkMath::Normalize(deltaVector);
2272
2273 int uMult = vtkAxisActorMultiplierTable1[this->AxisPosition];
2274 int vMult = vtkAxisActorMultiplierTable2[this->AxisPosition];
2275 // - Move outside points if needed (Axis -> Outside)
2276 if (this->TickLocation == VTK_TICKS_OUTSIDE || this->TickLocation == VTK_TICKS_BOTH)
2277 {
2278 for (int i = 0; i < 3; i++)
2279 {
2280 uPointOutside[i] += uVector[i] * uMult * this->MinorTickSize;
2281 vPointOutside[i] += vVector[i] * vMult * this->MinorTickSize;
2282 }
2283 }
2284
2285 // - Move inside points if needed (Axis -> Inside)
2286 if (this->TickLocation == VTK_TICKS_INSIDE || this->TickLocation == VTK_TICKS_BOTH)
2287 {
2288 for (int i = 0; i < 3; i++)
2289 {
2290 uPointInside[i] -= uVector[i] * uMult * this->MinorTickSize;
2291 vPointInside[i] -= vVector[i] * vMult * this->MinorTickSize;
2292 }
2293 }
2294
2295 // - Add the initial shift if any
2296 double axisShift = log10(this->MinorRangeStart / this->Range[0]) * rangeScale;
2297 axisLength -= axisShift;
2298 for (int i = 0; i < 3; i++)
2299 {
2300 uPointInside[i] += axisVector[i] * axisShift;
2301 vPointInside[i] += axisVector[i] * axisShift;
2302 uPointOutside[i] += axisVector[i] * axisShift;
2303 vPointOutside[i] += axisVector[i] * axisShift;
2304 }
2305

Callers 1

BuildTickPointsMethod · 0.95

Calls 9

isfiniteFunction · 0.85
NormFunction · 0.50
log10Function · 0.50
NormalizeFunction · 0.50
powFunction · 0.50
floorFunction · 0.50
ceilFunction · 0.50
AddFunction · 0.50
InsertNextPointMethod · 0.45

Tested by

no test coverage detected