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);
|
||||
points->Allocate(numLats * numLons);
|
||||
|
||||
|
||||
auto transform = createCartographicTransformFilter(uvGrid)->GetTransform();
|
||||
double *out = (double *)malloc(3*sizeof(double));
|
||||
// auto transform = createCartographicTransformFilter(uvGrid)->GetTransform();
|
||||
vtkSmartPointer<vtkTransformFilter> filter = createCartographicTransformFilter(uvGrid);
|
||||
auto transform = filter->GetTransform();
|
||||
double *out;
|
||||
|
||||
int i = 0;
|
||||
int latIndex = 0;
|
||||
|
|
@ -54,15 +55,14 @@ void EGlyphLayer::readCoordinates() {
|
|||
int lonIndex = 0;
|
||||
for (double lon: uvGrid->lons) {
|
||||
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.
|
||||
out = transform->TransformPoint(lon, lat, 0);
|
||||
out = transform->TransformPoint(lon, lat, 0.0);
|
||||
points->InsertPoint(i++, out[0], out[1], 0);
|
||||
lonIndex++;
|
||||
}
|
||||
latIndex++;
|
||||
}
|
||||
// free(out); //FIXME: causes a segfault for some reason?
|
||||
|
||||
this->data->SetPoints(points);
|
||||
this->data->GetPointData()->AddArray(this->direction);
|
||||
|
|
@ -78,6 +78,7 @@ void EGlyphLayer::readCoordinates() {
|
|||
vtkNew<vtkGlyph2D> glyph2D;
|
||||
glyph2D->SetSourceConnection(arrowSource->GetOutputPort());
|
||||
glyph2D->SetInputData(data);
|
||||
// glyph2D->SetInputConnection(transformFilter->GetOutputPort());
|
||||
glyph2D->OrientOn();
|
||||
glyph2D->ClampingOn();
|
||||
glyph2D->SetScaleModeToScaleByVector();
|
||||
|
|
@ -103,8 +104,8 @@ void EGlyphLayer::updateData(int t) {
|
|||
for (int lat = 0; lat < uvGrid->latSize; lat++) {
|
||||
for (int lon = 0; lon < uvGrid->lonSize; lon++) {
|
||||
auto [u, v] = (*uvGrid)[t/3600, lat, lon];
|
||||
// TODO: might want to multiple the u,v by some factor.
|
||||
this->direction->SetTuple3(i, u, v, 0);
|
||||
// TODO: 5*v scaling stuff should really be a filter transform
|
||||
this->direction->SetTuple3(i, u/2, v/2, 0);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue