------------------------------------------------------------------------------
| 60 | |
| 61 | //------------------------------------------------------------------------------ |
| 62 | int vtkSmoothErrorMetric::RequiresEdgeSubdivision( |
| 63 | double* leftPoint, double* midPoint, double* rightPoint, double vtkNotUsed(alpha)) |
| 64 | { |
| 65 | assert("pre: leftPoint_exists" && leftPoint != nullptr); |
| 66 | assert("pre: midPoint_exists" && midPoint != nullptr); |
| 67 | assert("pre: rightPoint_exists" && rightPoint != nullptr); |
| 68 | // assert( "pre: clamped_alpha" && alpha>0 && alpha < 1. ); // or else true |
| 69 | if (this->GenericCell->IsGeometryLinear()) |
| 70 | { |
| 71 | // don't need to do anything: |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | double a[3]; |
| 76 | double b[3]; |
| 77 | |
| 78 | a[0] = leftPoint[0] - midPoint[0]; |
| 79 | a[1] = leftPoint[1] - midPoint[1]; |
| 80 | a[2] = leftPoint[2] - midPoint[2]; |
| 81 | b[0] = rightPoint[0] - midPoint[0]; |
| 82 | b[1] = rightPoint[1] - midPoint[1]; |
| 83 | b[2] = rightPoint[2] - midPoint[2]; |
| 84 | |
| 85 | double dota = vtkMath::Dot(a, a); |
| 86 | double dotb = vtkMath::Dot(b, b); |
| 87 | double cosa; |
| 88 | |
| 89 | if (dota == 0 || dotb == 0) |
| 90 | { |
| 91 | cosa = -1.; |
| 92 | } |
| 93 | else |
| 94 | { |
| 95 | cosa = vtkMath::Dot(a, b) / sqrt(dota * dotb); |
| 96 | } |
| 97 | |
| 98 | int result = (cosa > this->CosTolerance); |
| 99 | |
| 100 | return result; |
| 101 | } |
| 102 | |
| 103 | //------------------------------------------------------------------------------ |
| 104 | // Description: |
no test coverage detected