Add face to each vertex only if the useset does not have the face yet.
| 2102 | |
| 2103 | // Add face to each vertex only if the useset does not have the face yet. |
| 2104 | void AddFace(vtkIdType faceIds[3], vtkDataArray* scalars, vtkIdType cellIdx, |
| 2105 | int orientationChanged, bool external) |
| 2106 | { |
| 2107 | // Ignore degenerate faces. |
| 2108 | if ((faceIds[0] == faceIds[1]) || (faceIds[1] == faceIds[2])) |
| 2109 | return; |
| 2110 | |
| 2111 | assert("pre: ordered ids" && faceIds[0] < faceIds[1] && faceIds[1] < faceIds[2]); |
| 2112 | |
| 2113 | vtkFace* f = this->GetFace(faceIds); |
| 2114 | if (f == nullptr) |
| 2115 | { |
| 2116 | int externalSide; |
| 2117 | if (external) |
| 2118 | { |
| 2119 | if (orientationChanged) |
| 2120 | { |
| 2121 | externalSide = vtkFace::BACK_FACE; |
| 2122 | } |
| 2123 | else |
| 2124 | { |
| 2125 | externalSide = vtkFace::FRONT_FACE; |
| 2126 | } |
| 2127 | } |
| 2128 | else |
| 2129 | { |
| 2130 | externalSide = vtkFace::NOT_EXTERNAL; |
| 2131 | } |
| 2132 | f = new vtkFace(faceIds, externalSide); |
| 2133 | this->AllFaces.push_back(f); |
| 2134 | f->Ref(); |
| 2135 | // All the vertices of this face need to be fed |
| 2136 | int i = 0; |
| 2137 | while (i < 3) |
| 2138 | { |
| 2139 | std::list<vtkFace*>* p = this->Vector[faceIds[i]]; |
| 2140 | if (p == nullptr) |
| 2141 | { |
| 2142 | p = new std::list<vtkFace*>; |
| 2143 | this->Vector[faceIds[i]] = p; |
| 2144 | } |
| 2145 | p->push_back(f); |
| 2146 | f->Ref(); |
| 2147 | ++i; |
| 2148 | } |
| 2149 | if (this->CellScalars) |
| 2150 | { |
| 2151 | int c = this->NumberOfComponents; |
| 2152 | int scalarNumber; |
| 2153 | if (orientationChanged) |
| 2154 | { |
| 2155 | scalarNumber = 1; |
| 2156 | } |
| 2157 | else |
| 2158 | { |
| 2159 | scalarNumber = 0; |
| 2160 | } |
| 2161 | if (c == 1) |
no test coverage detected