[vtkusers] VTK draw POINT ERREUR when x,y and Z are big
messari.omar
messari.omar at gmail.com
Thu Jun 14 07:18:31 EDT 2018
HELLO,
I'm trying to display my points (data comming from a magneto sensor) the
datas are between -600 and 600 i can't show them and i have a message error
that tells me that the format i'm trying to enter are incorrect.
but when i normalise my values ( -1<value<1) i can see my point on the
windowscontrol so i don't know what is the problem and how i can fix this,
to show the values between -600 and 600.
this is my code:
private void Point()
{
// Create the geometry of the points (the coordinate)
vtkPoints points = vtkPoints.New();
List<double> X = new List<double>(); // création de la liste
List<double> Y = new List<double>();
List<double> Z = new List<double>();
// Create topology of the points (a vertex per point)
vtkCellArray vertices = vtkCellArray.New();
double a = double.Parse(reader.MAGx.Text); // data comming from
the sensor
double b = double.Parse(reader.MAGy.Text);// data comming from
the sensor
double c = double.Parse(reader.MAGz.Text);// data comming from
the sensor
X.Add(a);
Y.Add(b);
Z.Add(c);
label7.Text = a.ToString();
int[] ids = new int[X.Count];
for (i = 0; i < X.Count; i++)
ids[i] = points.InsertNextPoint(X[i], Y[i], Z[i]);
int size = Marshal.SizeOf(typeof(int)) * X.Count;
IntPtr pIds = Marshal.AllocHGlobal(size);
Marshal.Copy(ids, 0, pIds, X.Count);
vertices.InsertNextCell(X.Count, pIds);
Marshal.FreeHGlobal(pIds);
// Create a polydata object
vtkPolyData pointPoly = vtkPolyData.New();
// Set the points and vertices we created as the geometry and
topology of the polydata
pointPoly.SetPoints(points);
pointPoly.SetVerts(vertices);
// Visualize
vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
mapper.SetInput(pointPoly);
vtkActor actor = vtkActor.New();
actor.SetMapper(mapper);
actor.GetProperty().SetPointSize(2);
vtkRenderWindow renderWindow =
renderWindowControl1.RenderWindow;
vtkRenderer renderer =
renderWindow.GetRenderers().GetFirstRenderer();
renderer.AddActor(actor);
renderWindow.Render();
}
Thanks all.
--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
More information about the vtkusers
mailing list