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

Method UpdateMaxError

Common/DataModel/vtkGenericCellTessellator.cxx:110–132  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Description: Update the max error of each error metric according to the error at the mid-point. The type of error depends on the state of the concrete error metric. For instance, it can return an absolute or relative error metric. See RequiresEdgeSubdivision() for a description of the arguments. \pre leftPoint_exists: l

Source from the content-addressed store, hash-verified

108// \pre valid_size: sizeof(leftPoint)=sizeof(midPoint)=sizeof(rightPoint)
109// =GetAttributeCollection()->GetNumberOfPointCenteredComponents()+6
110void vtkGenericCellTessellator::UpdateMaxError(
111 double* leftPoint, double* midPoint, double* rightPoint, double alpha)
112{
113 assert("pre: leftPoint_exists" && leftPoint != nullptr);
114 assert("pre: midPoint_exists" && midPoint != nullptr);
115 assert("pre: rightPoint_exists" && rightPoint != nullptr);
116 assert("pre: clamped_alpha" && alpha > 0 && alpha < 1);
117
118 this->ErrorMetrics->InitTraversal();
119 vtkGenericSubdivisionErrorMetric* e =
120 static_cast<vtkGenericSubdivisionErrorMetric*>(this->ErrorMetrics->GetNextItemAsObject());
121
122 // Once we found at least one error metric that need subdivision,
123 // the subdivision has to be done and there is no need to check for other
124 // error metrics.
125 for (int i = 0; e != nullptr; ++i)
126 {
127 double error = e->GetError(leftPoint, midPoint, rightPoint, alpha);
128 assert("check: positive_error" && error >= 0);
129 this->MaxErrors[i] = std::max(error, this->MaxErrors[i]);
130 e = static_cast<vtkGenericSubdivisionErrorMetric*>(this->ErrorMetrics->GetNextItemAsObject());
131 }
132}
133
134//------------------------------------------------------------------------------
135// Description:

Callers 1

Calls 5

GetNextItemAsObjectMethod · 0.80
assertFunction · 0.50
maxFunction · 0.50
InitTraversalMethod · 0.45
GetErrorMethod · 0.45

Tested by

no test coverage detected