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

Method FillCoordinates

IO/Geometry/vtkWindBladeReader.cxx:759–805  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Fill in the rectilinear points for the requested subextents ------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

757// Fill in the rectilinear points for the requested subextents
758//------------------------------------------------------------------------------
759void vtkWindBladeReader::FillCoordinates()
760{
761 this->Points->Delete();
762 this->Points = vtkPoints::New();
763
764 // If dataset is flat, x and y are constant spacing, z is stretched
765 if (this->UseTopographyFile == 0)
766 {
767 // Save vtkPoints instead of spacing coordinates because topography file
768 // requires this to be vtkStructuredGrid and not vtkRectilinearGrid
769 for (int k = this->SubExtent[4]; k <= this->SubExtent[5]; k++)
770 {
771 float z = this->ZSpacing->GetValue(k);
772 for (int j = this->SubExtent[2]; j <= this->SubExtent[3]; j++)
773 {
774 float y = this->YSpacing->GetValue(j);
775 for (int i = this->SubExtent[0]; i <= this->SubExtent[1]; i++)
776 {
777 float x = this->XSpacing->GetValue(i);
778 this->Points->InsertNextPoint(x, y, z);
779 }
780 }
781 }
782 }
783
784 // If dataset is topographic, x and y are constant spacing
785 // Z data is calculated from an x by y topographic data file
786 else
787 {
788 int planeSize = this->Dimension[0] * this->Dimension[1];
789 int rowSize = this->Dimension[0];
790
791 for (int k = this->SubExtent[4]; k <= this->SubExtent[5]; k++)
792 {
793 for (int j = this->SubExtent[2]; j <= this->SubExtent[3]; j++)
794 {
795 float y = this->YSpacing->GetValue(j);
796 for (int i = this->SubExtent[0]; i <= this->SubExtent[1]; i++)
797 {
798 float x = this->XSpacing->GetValue(i);
799 int index = (k * planeSize) + (j * rowSize) + i;
800 this->Points->InsertNextPoint(x, y, this->ZTopographicValues[index]);
801 }
802 }
803 }
804 }
805}
806
807//------------------------------------------------------------------------------
808// Fill in the rectilinear points for the requested subextents

Callers 1

InitFieldDataMethod · 0.95

Calls 4

DeleteMethod · 0.65
NewFunction · 0.50
GetValueMethod · 0.45
InsertNextPointMethod · 0.45

Tested by

no test coverage detected