Skip to content
Snippets Groups Projects
Commit eac2b0d7 authored by Owen Arnold's avatar Owen Arnold
Browse files

Refs #3444. Fix coordinate -> hexahedron mapping.

parent c92d366f
No related branches found
No related tags found
No related merge requests found
...@@ -61,7 +61,7 @@ namespace Mantid ...@@ -61,7 +61,7 @@ namespace Mantid
std::vector<Mantid::Geometry::Coordinate> coords; std::vector<Mantid::Geometry::Coordinate> coords;
Mantid::signal_t signal_normalized; Mantid::signal_t signal_normalized;
vtkIdType pointId; vtkIdType pointIds[8];
while(true) while(true)
{ {
box = it.getBox(); box = it.getBox();
...@@ -81,10 +81,25 @@ namespace Mantid ...@@ -81,10 +81,25 @@ namespace Mantid
{ {
Mantid::Geometry::Coordinate& coord = coords[i]; Mantid::Geometry::Coordinate& coord = coords[i];
//Add points //Add points
pointId = points->InsertNextPoint(coord.getX(), coord.getY(), coord.getZ()); pointIds[i] = points->InsertNextPoint(coord.getX(), coord.getY(), coord.getZ());
theHex->GetPointIds()->SetId(i, pointId);
} }
/*
VTK needs cell points to be specified in a particular anti-clockwise ordering.
The coordinates gernated by IBox do not fit this format, so have to manually reorder them before setting the
hexahedron vertexes.
*/
theHex->GetPointIds()->SetId(0, pointIds[0]); //xyx
theHex->GetPointIds()->SetId(1, pointIds[1]); //dxyz
theHex->GetPointIds()->SetId(2, pointIds[3]); //dxdyz
theHex->GetPointIds()->SetId(3, pointIds[2]); //xdyz
theHex->GetPointIds()->SetId(4, pointIds[4]); //xydz
theHex->GetPointIds()->SetId(5, pointIds[5]); //dxydz
theHex->GetPointIds()->SetId(6, pointIds[7]); //dxdydz
theHex->GetPointIds()->SetId(7, pointIds[6]); //xdydz
//Add cells //Add cells
visualDataSet->InsertNextCell(VTK_HEXAHEDRON, theHex->GetPointIds()); visualDataSet->InsertNextCell(VTK_HEXAHEDRON, theHex->GetPointIds());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment