[vtkusers] Bug with the java wrapper

galera tonio.guillen at gmail.com
Thu Mar 17 14:07:09 EDT 2016


Hi all,

I found a bug with the java wrapper for example:

			double thresholdValue = Math.pow(10, 10);
			vtkRectilinearGrid input = (vtkRectilinearGrid)
this.getInput().getValue();
			vtkDataArray values = input.GetCellData().GetScalars();
		
			int k;
			for(int i = 0; i < input.GetNumberOfCells(); i++) {
				double x = 0, y = 0, z = 0;
				for(k = 0; k < input.GetCell(i).GetPoints().GetNumberOfPoints(); k++) {
					double[] pcoords = input.GetCell(i).GetPoints().GetPoint(k);
					x += pcoords[0];
					y += pcoords[1];
					z += pcoords[2];
				}
				Point3D p = new Point3D(x/k, y/k, z/k);
				int rank = model.rank(p, true);
				if (!this.getEntities().contains(model.getFormationWithRank(rank ))) {
					values.SetTuple1(i, thresholdValue);
				}
			}
			input.GetCellData().SetScalars(values);
			vtkThreshold threshold = new vtkThreshold();
			threshold.SetInputData(input);
			threshold.ThresholdByLower(thresholdValue-1.);
	
			threshold.Update();

			vtkUnstructuredGrid output = threshold.GetOutput();
			Pipe<vtkUnstructuredGrid> pipe = FilterFactory.eINSTANCE.createPipe();
			pipe.setValue(output);
			this.getOutput().add(pipe);


This code work fine if you set:
 double thresholdValue = Math.pow(10, 10);

if you set:
double thresholdValue = Double.MAX_VALUE;

you have a bug.

Galera



--
View this message in context: http://vtk.1045678.n5.nabble.com/Bug-with-the-java-wrapper-tp5737254.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list