------------------------------------------------------------------------------
| 109 | |
| 110 | //------------------------------------------------------------------------------ |
| 111 | int vtkMergePoints::InsertUniquePoint(const double x[3], vtkIdType& id) |
| 112 | { |
| 113 | // |
| 114 | // Locate bucket that point is in. |
| 115 | // |
| 116 | vtkIdType idx = this->GetBucketIndex(x); |
| 117 | vtkIdList* bucket = this->HashTable[idx]; |
| 118 | |
| 119 | if (bucket) // see whether we've got duplicate point |
| 120 | { |
| 121 | // |
| 122 | // Check the list of points in that bucket. |
| 123 | // |
| 124 | vtkIdType ptId = vtkMergePointsFindPointInBucket(bucket, this->Points, x); |
| 125 | if (ptId != -1) |
| 126 | { |
| 127 | // point is already in the list, return 0 and set the id parameter |
| 128 | id = ptId; |
| 129 | return 0; |
| 130 | } |
| 131 | } |
| 132 | else |
| 133 | { |
| 134 | // create a bucket point list and insert the point |
| 135 | bucket = vtkIdList::New(); |
| 136 | bucket->Allocate(this->NumberOfPointsPerBucket / 2, this->NumberOfPointsPerBucket / 3); |
| 137 | this->HashTable[idx] = bucket; |
| 138 | } |
| 139 | |
| 140 | // point has to be added |
| 141 | bucket->InsertNextId(this->InsertionPointId); |
| 142 | this->Points->InsertPoint(this->InsertionPointId, x); |
| 143 | id = this->InsertionPointId++; |
| 144 | |
| 145 | return 1; |
| 146 | } |
| 147 | |
| 148 | //------------------------------------------------------------------------------ |
| 149 | void vtkMergePoints::PrintSelf(ostream& os, vtkIndent indent) |
nothing calls this directly
no test coverage detected