------------------------------------------------------------------------------ Description: Return 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. \post positive_result: result>=0
| 140 | // See RequiresEdgeSubdivision() for a description of the arguments. |
| 141 | // \post positive_result: result>=0 |
| 142 | double vtkGeometricErrorMetric::GetError(double* leftPoint, double* midPoint, double* rightPoint, |
| 143 | #ifdef VTK_DISTANCE_LINE_POINT |
| 144 | double vtkNotUsed(alpha) |
| 145 | #else |
| 146 | double alpha |
| 147 | #endif |
| 148 | ) |
| 149 | { |
| 150 | assert("pre: leftPoint_exists" && leftPoint != nullptr); |
| 151 | assert("pre: midPoint_exists" && midPoint != nullptr); |
| 152 | assert("pre: rightPoint_exists" && rightPoint != nullptr); |
| 153 | // assert("pre: clamped_alpha" && alpha>0 && alpha<1); // or else true |
| 154 | if (this->GenericCell->IsGeometryLinear()) |
| 155 | { |
| 156 | // don't need to do anything: |
| 157 | return 0; |
| 158 | } |
| 159 | // distance between the line (leftPoint,rightPoint) and the point midPoint. |
| 160 | #ifdef VTK_DISTANCE_LINE_POINT |
| 161 | double squareAbsoluteError = this->Distance2LinePoint(leftPoint, rightPoint, midPoint); |
| 162 | #else |
| 163 | // Interpolated point |
| 164 | double interpolatedPoint[3]; |
| 165 | int i = 0; |
| 166 | while (i < 3) |
| 167 | { |
| 168 | interpolatedPoint[i] = leftPoint[i] + alpha * (rightPoint[i] - leftPoint[i]); |
| 169 | ++i; |
| 170 | } |
| 171 | double squareAbsoluteError = vtkMath::Distance2BetweenPoints(midPoint, interpolatedPoint); |
| 172 | #endif |
| 173 | if (this->Relative) |
| 174 | { |
| 175 | return sqrt(squareAbsoluteError) / this->SmallestSize; |
| 176 | } |
| 177 | else |
| 178 | { |
| 179 | return squareAbsoluteError; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | //------------------------------------------------------------------------------ |
| 184 | // Description: |
nothing calls this directly
no test coverage detected