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

Method TransformPointInformation

Filters/Geometry/vtkProjectSphereFilter.cxx:128–195  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

126
127//------------------------------------------------------------------------------
128void vtkProjectSphereFilter::TransformPointInformation(
129 vtkPointSet* input, vtkPointSet* output, vtkIdList* polePointIds)
130{
131 polePointIds->Reset();
132
133 // Deep copy point data since TransformPointInformation modifies
134 // the point data
135 output->GetPointData()->DeepCopy(input->GetPointData());
136
137 vtkNew<vtkPoints> points;
138 points->SetDataTypeToDouble();
139 points->SetNumberOfPoints(input->GetNumberOfPoints());
140
141 double zTranslation = (this->TranslateZ ? this->GetZTranslation(input) : 0.);
142
143 output->SetPoints(points.GetPointer());
144 vtkIdType numberOfPoints = input->GetNumberOfPoints();
145 double minDist2ToCenterLine = VTK_DOUBLE_MAX;
146 for (vtkIdType i = 0; i < numberOfPoints; i++)
147 {
148 if (this->CheckAbort())
149 {
150 break;
151 }
152 double coordIn[3], coordOut[3];
153 input->GetPoint(i, coordIn);
154 ConvertXYZToLatLonDepth(coordIn, coordOut, this->Center);
155 // if we allow the user to specify SplitLongitude we have to make
156 // sure that we respect their choice since the output of atan
157 // is from -180 to 180.
158 if (coordOut[0] < this->SplitLongitude)
159 {
160 coordOut[0] += 360.;
161 }
162 coordOut[2] -= zTranslation;
163
164 // acbauer -- a hack to make the grid look better by forcing it to be flat.
165 // leaving this in for now even though it's commented out. if I figure out
166 // a proper way to do this i'll replace it.
167 // if(this->TranslateZ)
168 // {
169 // coordOut[2] = 0;
170 // }
171 points->SetPoint(i, coordOut);
172
173 // keep track of the ids of the points that are closest to the
174 // centerline between -90 and 90 latitude. this is done as a single
175 // pass algorithm.
176 double dist2 = (coordIn[0] - this->Center[0]) * (coordIn[0] - this->Center[0]) +
177 (coordIn[1] - this->Center[1]) * (coordIn[1] - this->Center[1]);
178 if (dist2 < minDist2ToCenterLine)
179 {
180 // we found a closer point so throw out the previous closest
181 // point ids.
182 minDist2ToCenterLine = dist2;
183 polePointIds->SetNumberOfIds(1);
184 polePointIds->SetId(0, i);
185 }

Callers 1

RequestDataMethod · 0.95

Calls 15

GetZTranslationMethod · 0.95
TransformTensorsMethod · 0.95
ConvertXYZToLatLonDepthFunction · 0.85
CheckAbortMethod · 0.80
SetNumberOfIdsMethod · 0.80
InsertNextIdMethod · 0.80
ResetMethod · 0.45
DeepCopyMethod · 0.45
GetPointDataMethod · 0.45
SetNumberOfPointsMethod · 0.45
GetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected