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

Method SetRelativeGeometricTolerance

Common/DataModel/vtkGeometricErrorMetric.cxx:54–94  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Description : Set the geometric accuracy with a value relative to the bounding box of the dataset. Internally compute the absolute tolerance. For instance 0.01 will give better result than 0.1. \pre valid_range_value: value>0 && value<1 \pre ds_exists: ds!=0

Source from the content-addressed store, hash-verified

52// \pre valid_range_value: value>0 && value<1
53// \pre ds_exists: ds!=0
54void vtkGeometricErrorMetric::SetRelativeGeometricTolerance(double value, vtkGenericDataSet* ds)
55{
56 assert("pre: valid_range_value" && value > 0 && value < 1);
57 assert("pre: ds_exists" && ds != nullptr);
58
59 double bounds[6];
60 ds->GetBounds(bounds);
61 double smallest;
62 double length;
63 smallest = bounds[1] - bounds[0];
64 length = bounds[3] - bounds[2];
65 if (length < smallest || smallest == 0.0)
66 {
67 smallest = length;
68 }
69 length = bounds[5] - bounds[4];
70 if (length < smallest || smallest == 0.0)
71 {
72 smallest = length;
73 }
74 length = ds->GetLength();
75 if (length < smallest || smallest == 0.0)
76 {
77 smallest = length;
78 }
79 if (smallest == 0)
80 {
81 smallest = 1;
82 }
83 double tmp = value * smallest;
84 this->SmallestSize = smallest;
85 std::cout << "this->SmallestSize=" << this->SmallestSize << endl;
86 this->Relative = 1;
87 tmp = tmp * tmp;
88
89 if (this->AbsoluteGeometricTolerance != tmp)
90 {
91 this->AbsoluteGeometricTolerance = tmp;
92 this->Modified();
93 }
94}
95
96#define VTK_DISTANCE_LINE_POINT
97

Callers 9

TestGenericStreamTracerFunction · 0.80
TestGenericCutterFunction · 0.80
TestGenericGlyph3DFilterFunction · 0.80
TestGenericContourFilterFunction · 0.80
TestGenericClipFunction · 0.80
TestGenericProbeFilterFunction · 0.80

Calls 4

assertFunction · 0.50
GetBoundsMethod · 0.45
GetLengthMethod · 0.45
ModifiedMethod · 0.45

Tested by 9

TestGenericStreamTracerFunction · 0.64
TestGenericCutterFunction · 0.64
TestGenericGlyph3DFilterFunction · 0.64
TestGenericContourFilterFunction · 0.64
TestGenericClipFunction · 0.64
TestGenericProbeFilterFunction · 0.64