Feat: Improved organisation of Cartographic transformation

This commit is contained in:
robin committed 2024-05-05 16:33:45 +02:00
1 parent 346e44da48
commit 3356b5561a
11 files changed
+109 -74

No files matched your search

+7 -1
View File
@@ -7,6 +7,8 @@
#include <vtkCommand.h>
#include <vtkRenderWindow.h>
#include "CartographicTransformation.h"
void convertDisplayToWorld(vtkRenderer* renderer, int x, int y, double *worldPos) {
double displayPos[3] = {static_cast<double>(x), static_cast<double>(y), 0.0};
renderer->SetDisplayPoint(displayPos);
@@ -36,6 +38,7 @@ void SpawnPointCallback::Execute(vtkObject *caller, unsigned long evId, void *ca
ren->SetDisplayPoint(displayPos);
ren->DisplayToWorld();
ren->GetWorldPoint(worldPos);
inverseCartographicProjection->MultiplyPoint(worldPos, worldPos);
cout << "clicked on lon = " << worldPos[0] << " and lat = " << worldPos[1] << endl;
vtkIdType id = points->InsertNextPoint(worldPos[0], worldPos[1], 0);
@@ -52,7 +55,10 @@ void SpawnPointCallback::Execute(vtkObject *caller, unsigned long evId, void *ca
}
SpawnPointCallback::SpawnPointCallback() : data(nullptr), points(nullptr) {}
SpawnPointCallback::SpawnPointCallback() : data(nullptr), points(nullptr), inverseCartographicProjection(nullptr) {
inverseCartographicProjection = getCartographicTransformMatrix();
inverseCartographicProjection->Invert();
}
SpawnPointCallback *SpawnPointCallback::New() {
return new SpawnPointCallback;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.