fix: do not call GetTransform in the same line as CreateCartographicTransformation
This commit is contained in:
parent
af1fc0afc0
commit
438bc841d9
|
|
@ -44,9 +44,10 @@ void EGlyphLayer::readCoordinates() {
|
||||||
this->direction->SetNumberOfTuples(numLats * numLons);
|
this->direction->SetNumberOfTuples(numLats * numLons);
|
||||||
points->Allocate(numLats * numLons);
|
points->Allocate(numLats * numLons);
|
||||||
|
|
||||||
|
// auto transform = createCartographicTransformFilter(uvGrid)->GetTransform();
|
||||||
auto transform = createCartographicTransformFilter(uvGrid)->GetTransform();
|
vtkSmartPointer<vtkTransformFilter> filter = createCartographicTransformFilter(uvGrid);
|
||||||
double *out = (double *)malloc(3*sizeof(double));
|
auto transform = filter->GetTransform();
|
||||||
|
double *out;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int latIndex = 0;
|
int latIndex = 0;
|
||||||
|
|
@ -54,15 +55,14 @@ void EGlyphLayer::readCoordinates() {
|
||||||
int lonIndex = 0;
|
int lonIndex = 0;
|
||||||
for (double lon: uvGrid->lons) {
|
for (double lon: uvGrid->lons) {
|
||||||
auto [u, v] = (*uvGrid)[0, latIndex, lonIndex];
|
auto [u, v] = (*uvGrid)[0, latIndex, lonIndex];
|
||||||
direction->SetTuple3(i, 5*u, 5*v, 0);
|
direction->SetTuple3(i, u/2, v/2, 0);
|
||||||
// pre-transform the points, so we don't have to include the cartographic transform while running the program.
|
// pre-transform the points, so we don't have to include the cartographic transform while running the program.
|
||||||
out = transform->TransformPoint(lon, lat, 0);
|
out = transform->TransformPoint(lon, lat, 0.0);
|
||||||
points->InsertPoint(i++, out[0], out[1], 0);
|
points->InsertPoint(i++, out[0], out[1], 0);
|
||||||
lonIndex++;
|
lonIndex++;
|
||||||
}
|
}
|
||||||
latIndex++;
|
latIndex++;
|
||||||
}
|
}
|
||||||
// free(out); //FIXME: causes a segfault for some reason?
|
|
||||||
|
|
||||||
this->data->SetPoints(points);
|
this->data->SetPoints(points);
|
||||||
this->data->GetPointData()->AddArray(this->direction);
|
this->data->GetPointData()->AddArray(this->direction);
|
||||||
|
|
@ -78,6 +78,7 @@ void EGlyphLayer::readCoordinates() {
|
||||||
vtkNew<vtkGlyph2D> glyph2D;
|
vtkNew<vtkGlyph2D> glyph2D;
|
||||||
glyph2D->SetSourceConnection(arrowSource->GetOutputPort());
|
glyph2D->SetSourceConnection(arrowSource->GetOutputPort());
|
||||||
glyph2D->SetInputData(data);
|
glyph2D->SetInputData(data);
|
||||||
|
// glyph2D->SetInputConnection(transformFilter->GetOutputPort());
|
||||||
glyph2D->OrientOn();
|
glyph2D->OrientOn();
|
||||||
glyph2D->ClampingOn();
|
glyph2D->ClampingOn();
|
||||||
glyph2D->SetScaleModeToScaleByVector();
|
glyph2D->SetScaleModeToScaleByVector();
|
||||||
|
|
@ -103,8 +104,8 @@ void EGlyphLayer::updateData(int t) {
|
||||||
for (int lat = 0; lat < uvGrid->latSize; lat++) {
|
for (int lat = 0; lat < uvGrid->latSize; lat++) {
|
||||||
for (int lon = 0; lon < uvGrid->lonSize; lon++) {
|
for (int lon = 0; lon < uvGrid->lonSize; lon++) {
|
||||||
auto [u, v] = (*uvGrid)[t/3600, lat, lon];
|
auto [u, v] = (*uvGrid)[t/3600, lat, lon];
|
||||||
// TODO: might want to multiple the u,v by some factor.
|
// TODO: 5*v scaling stuff should really be a filter transform
|
||||||
this->direction->SetTuple3(i, u, v, 0);
|
this->direction->SetTuple3(i, u/2, v/2, 0);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue