From 9c497e39c440ebad0946561276e28b842da79e42 Mon Sep 17 00:00:00 2001
From: Piero Toffanin <pt@masseranolabs.com>
Date: Tue, 16 Jan 2018 15:59:58 -0500
Subject: [PATCH] Fixed bounds and center calculation

---
 modules/odm_25dmeshing/src/Odm25dMeshing.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/odm_25dmeshing/src/Odm25dMeshing.cpp b/modules/odm_25dmeshing/src/Odm25dMeshing.cpp
index 1da5a9d9..cc977ecf 100644
--- a/modules/odm_25dmeshing/src/Odm25dMeshing.cpp
+++ b/modules/odm_25dmeshing/src/Odm25dMeshing.cpp
@@ -87,6 +87,12 @@ void Odm25dMeshing::buildMesh(){
 		  vtkSmartPointer<vtkPolyData>::New();
 	polyPoints->SetPoints(points);
 
+	double *bounds = polyPoints->GetBounds();
+	double *center = polyPoints->GetCenter();
+
+	double extentX = bounds[1] - bounds[0];
+	double extentY = bounds[3] - bounds[2];
+
 	vtkSmartPointer<vtkOctreePointLocator> locator = vtkSmartPointer<vtkOctreePointLocator>::New();
 
 	vtkSmartPointer<vtkRadiusOutlierRemoval> radiusRemoval =
@@ -135,12 +141,6 @@ void Odm25dMeshing::buildMesh(){
 
 	const float NODATA = -9999;
 
-	double *bounds = polydataToProcess->GetBounds();
-	double *center = polydataToProcess->GetCenter();
-
-	double extentX = bounds[1] - bounds[0];
-	double extentY = bounds[3] - bounds[2];
-
 	if (resolution == 0.0){
 		resolution = (double)maxVertexCount / (sqrt(extentX * extentY) * 75.0);
 		log << "Automatically set resolution to " << std::fixed << resolution << "\n";