-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g3d.vtk.gizmo;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import vtk.vtkActor;\r
-import vtk.vtkDataSetMapper;\r
-import vtk.vtkPoints;\r
-import vtk.vtkPolyData;\r
-import vtk.vtkProp;\r
-import vtk.vtkTriangle;\r
-\r
-public class TranslateGizmo extends vtkGizmo {\r
- \r
- \r
- \r
- private List<vtkProp> parts;\r
- \r
- @Override\r
- public Collection<vtkProp> getGizmo() {\r
- if (parts == null) {\r
- parts = new ArrayList<vtkProp>();\r
- \r
- \r
- float size = 2.f; \r
- float sizeD2 = 1.f;\r
- float offset = 0.2f;\r
- \r
- double[] colorX = new double[]{0.5,0.0,0.0};\r
- double[] colorY = new double[]{0.0,0.5,0.0};\r
- double[] colorZ = new double[]{0.0,0.0,0.5};\r
- \r
- double[] colorXY = add(colorX, colorY);\r
- double[] colorXZ = add(colorX, colorZ);\r
- double[] colorYZ = add(colorY, colorZ);\r
- double[] colorP = add(colorX,colorY,colorZ);\r
- \r
- vtkActor actorX = new vtkActor();\r
- vtkActor actorY = new vtkActor();\r
- vtkActor actorZ = new vtkActor();\r
- vtkActor actorXY = new vtkActor();\r
- vtkActor actorXZ = new vtkActor();\r
- vtkActor actorYZ = new vtkActor();\r
- vtkActor actorP = new vtkActor();\r
- \r
- actorX.GetProperty().SetColor(colorX);\r
- actorY.GetProperty().SetColor(colorY);\r
- actorZ.GetProperty().SetColor(colorZ);\r
- actorXY.GetProperty().SetColor(colorXY);\r
- actorXZ.GetProperty().SetColor(colorXZ);\r
- actorYZ.GetProperty().SetColor(colorYZ);\r
- actorP.GetProperty().SetColor(colorP);\r
- \r
- actorX.GetProperty().SetOpacity(0.5);\r
- actorY.GetProperty().SetOpacity(0.5);\r
- actorZ.GetProperty().SetOpacity(0.5);\r
- actorXY.GetProperty().SetOpacity(0.5);\r
- actorXZ.GetProperty().SetOpacity(0.5);\r
- actorYZ.GetProperty().SetOpacity(0.5);\r
- actorP.GetProperty().SetOpacity(0.5);\r
- \r
- actorX.GetProperty().BackfaceCullingOff();\r
- actorY.GetProperty().BackfaceCullingOff();\r
- actorZ.GetProperty().BackfaceCullingOff();\r
- actorXY.GetProperty().BackfaceCullingOff();\r
- actorXZ.GetProperty().BackfaceCullingOff();\r
- actorYZ.GetProperty().BackfaceCullingOff();\r
- actorP.GetProperty().BackfaceCullingOff();\r
- \r
- actorX.SetPickable(1);\r
- actorY.SetPickable(1);\r
- actorZ.SetPickable(1);\r
- actorXY.SetPickable(1);\r
- actorXZ.SetPickable(1);\r
- actorYZ.SetPickable(1);\r
- actorP.SetPickable(1);\r
- \r
- \r
- actorX.GetProperty().LightingOff();\r
- actorY.GetProperty().LightingOff();\r
- actorZ.GetProperty().LightingOff();\r
- actorXY.GetProperty().LightingOff();\r
- actorXZ.GetProperty().LightingOff();\r
- actorYZ.GetProperty().LightingOff();\r
- actorP.GetProperty().LightingOff();\r
- \r
-\r
- vtkTriangle triangle = new vtkTriangle();\r
- \r
- // X\r
- vtkPolyData actorXData = new vtkPolyData();\r
- actorXData.Allocate(6, 6);\r
- \r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 1);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorXData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 1);\r
- triangle.GetPointIds().SetId(1, 2);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorXData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 3);\r
- triangle.GetPointIds().SetId(2, 5);\r
- actorXData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 3);\r
- triangle.GetPointIds().SetId(1, 4);\r
- triangle.GetPointIds().SetId(2, 5);\r
- actorXData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- \r
- vtkPoints partPoints = new vtkPoints();\r
- partPoints.InsertPoint(0, new double[]{size,0.,0.});\r
- partPoints.InsertPoint(1, new double[]{size-offset,offset,0.});\r
- partPoints.InsertPoint(2, new double[]{sizeD2-offset,offset,0.});\r
- partPoints.InsertPoint(3, new double[]{sizeD2,0.,0.});\r
- partPoints.InsertPoint(4, new double[]{sizeD2-offset,0.,offset});\r
- partPoints.InsertPoint(5, new double[]{size-offset,0.,offset});\r
- actorXData.SetPoints(partPoints);\r
- partPoints.Delete();\r
- \r
- // Y\r
- vtkPolyData actorYData = new vtkPolyData();\r
- actorYData.Allocate(6, 6);\r
- \r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 1);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 1);\r
- triangle.GetPointIds().SetId(1, 2);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 3);\r
- triangle.GetPointIds().SetId(2, 5);\r
- actorYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 3);\r
- triangle.GetPointIds().SetId(1, 4);\r
- triangle.GetPointIds().SetId(2, 5);\r
- actorYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- \r
- partPoints = new vtkPoints();\r
- partPoints.InsertPoint(0, new double[]{0., size, 0.});\r
- partPoints.InsertPoint(1, new double[]{offset, size - offset, 0.});\r
- partPoints.InsertPoint(2, new double[]{offset, sizeD2 - offset, 0.});\r
- partPoints.InsertPoint(3, new double[]{0., sizeD2, 0.});\r
- partPoints.InsertPoint(4, new double[]{0., sizeD2 - offset, offset});\r
- partPoints.InsertPoint(5, new double[]{0., size - offset, offset});\r
- actorYData.SetPoints(partPoints);\r
- partPoints.Delete();\r
- \r
- // Z\r
- vtkPolyData actorZData = new vtkPolyData();\r
- actorZData.Allocate(6, 6);\r
- \r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 1);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 1);\r
- triangle.GetPointIds().SetId(1, 2);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 3);\r
- triangle.GetPointIds().SetId(2, 5);\r
- actorZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 3);\r
- triangle.GetPointIds().SetId(1, 4);\r
- triangle.GetPointIds().SetId(2, 5);\r
- actorZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- \r
- partPoints = new vtkPoints();\r
- partPoints.InsertPoint(0, new double[]{0., 0.,size});\r
- partPoints.InsertPoint(1, new double[]{offset, 0., size - offset});\r
- partPoints.InsertPoint(2, new double[]{offset, 0., sizeD2 - offset});\r
- partPoints.InsertPoint(3, new double[]{0., 0., sizeD2});\r
- partPoints.InsertPoint(4, new double[]{0., offset, sizeD2 - offset});\r
- partPoints.InsertPoint(5, new double[]{0., offset, size - offset});\r
- actorZData.SetPoints(partPoints);\r
- partPoints.Delete();\r
- \r
- // XY\r
- vtkPolyData actorXYData = new vtkPolyData();\r
- actorXYData.Allocate(4, 4);\r
- \r
- triangle.GetPointIds().SetId(0, 2);\r
- triangle.GetPointIds().SetId(1, 1);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorXYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 1);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorXYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- \r
- partPoints = new vtkPoints();\r
- partPoints.InsertPoint(0, new double[]{offset, size-offset, 0.f});\r
- partPoints.InsertPoint(1, new double[]{offset, sizeD2 - offset, 0.f});\r
- partPoints.InsertPoint(2, new double[]{sizeD2 - offset, offset, 0.f});\r
- partPoints.InsertPoint(3, new double[]{size-offset, offset, 0.f});\r
- actorXYData.SetPoints(partPoints);\r
- partPoints.Delete();\r
- \r
- // XZ\r
- vtkPolyData actorXZData = new vtkPolyData();\r
- actorXZData.Allocate(4, 4);\r
- \r
- triangle.GetPointIds().SetId(0, 2);\r
- triangle.GetPointIds().SetId(1, 1);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorXZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 1);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorXZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- \r
- partPoints = new vtkPoints();\r
- partPoints.InsertPoint(0, new double[]{offset, 0.f, size-offset});\r
- partPoints.InsertPoint(1, new double[]{offset, 0.f, sizeD2 - offset});\r
- partPoints.InsertPoint(2, new double[]{sizeD2 - offset, 0.f, offset});\r
- partPoints.InsertPoint(3, new double[]{size-offset, 0.f, offset});\r
- actorXZData.SetPoints(partPoints);\r
- partPoints.Delete();\r
- \r
- // YZ\r
- vtkPolyData actorYZData = new vtkPolyData();\r
- actorYZData.Allocate(4, 4);\r
- \r
- triangle.GetPointIds().SetId(0, 2);\r
- triangle.GetPointIds().SetId(1, 1);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorYZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 1);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorYZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- \r
- partPoints = new vtkPoints();\r
- partPoints.InsertPoint(0, new double[]{0.f,offset, size-offset});\r
- partPoints.InsertPoint(1, new double[]{0.f,offset, sizeD2 - offset});\r
- partPoints.InsertPoint(2, new double[]{0.f,sizeD2 - offset, offset});\r
- partPoints.InsertPoint(3, new double[]{0.f,size-offset, offset});\r
- \r
- actorYZData.SetPoints(partPoints);\r
- partPoints.Delete();\r
- \r
- vtkPolyData actorPData = new vtkPolyData();\r
- actorPData.Allocate(10, 10);\r
- \r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 1);\r
- triangle.GetPointIds().SetId(2, 2);\r
- actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 2);\r
- triangle.GetPointIds().SetId(2, 3);\r
- actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 3);\r
- triangle.GetPointIds().SetId(2, 4);\r
- actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 4);\r
- triangle.GetPointIds().SetId(2, 5);\r
- actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 5);\r
- triangle.GetPointIds().SetId(2, 6);\r
- actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 6);\r
- triangle.GetPointIds().SetId(2, 7);\r
- actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 7);\r
- triangle.GetPointIds().SetId(2, 8);\r
- actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 8);\r
- triangle.GetPointIds().SetId(2, 9);\r
- actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- triangle.GetPointIds().SetId(0, 0);\r
- triangle.GetPointIds().SetId(1, 9);\r
- triangle.GetPointIds().SetId(2, 1);\r
- actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());\r
- \r
- partPoints = new vtkPoints();\r
- partPoints.InsertPoint(0, new double[]{0.f, 0.f, 0.f});\r
- partPoints.InsertPoint(1, new double[]{sizeD2, 0.f, 0.f});\r
- partPoints.InsertPoint(2, new double[]{sizeD2 - offset, offset, 0.f});\r
- partPoints.InsertPoint(3, new double[]{offset, sizeD2 - offset, 0.f});\r
- partPoints.InsertPoint(4, new double[]{0.f, sizeD2, 0.f});\r
- partPoints.InsertPoint(5, new double[]{0.f, sizeD2 - offset, offset});\r
- partPoints.InsertPoint(6, new double[]{0.f, offset, sizeD2-offset});\r
- partPoints.InsertPoint(7, new double[]{0.f, 0.f, sizeD2});\r
- partPoints.InsertPoint(8, new double[]{offset, 0.f, sizeD2-offset});\r
- partPoints.InsertPoint(9, new double[]{sizeD2-offset, 0.f, offset});\r
- actorPData.SetPoints(partPoints);\r
- partPoints.Delete();\r
- \r
- \r
- vtkDataSetMapper partMapper = new vtkDataSetMapper();\r
- partMapper.SetInput(actorXData);\r
- partMapper.ScalarVisibilityOn();\r
- actorX.SetMapper(partMapper);\r
- partMapper.Delete();\r
- \r
- partMapper = new vtkDataSetMapper();\r
- partMapper.SetInput(actorYData);\r
- partMapper.ScalarVisibilityOn();\r
- actorY.SetMapper(partMapper);\r
- partMapper.Delete();\r
- \r
- partMapper = new vtkDataSetMapper();\r
- partMapper.SetInput(actorZData);\r
- partMapper.ScalarVisibilityOn();\r
- actorZ.SetMapper(partMapper);\r
- partMapper.Delete();\r
- \r
- partMapper = new vtkDataSetMapper();\r
- partMapper.SetInput(actorXYData);\r
- partMapper.ScalarVisibilityOn();\r
- actorXY.SetMapper(partMapper);\r
- partMapper.Delete();\r
- \r
- partMapper = new vtkDataSetMapper();\r
- partMapper.SetInput(actorXZData);\r
- partMapper.ScalarVisibilityOn();\r
- actorXZ.SetMapper(partMapper);\r
- partMapper.Delete();\r
- \r
- partMapper = new vtkDataSetMapper();\r
- partMapper.SetInput(actorYZData);\r
- partMapper.ScalarVisibilityOn();\r
- actorYZ.SetMapper(partMapper);\r
- partMapper.Delete();\r
- \r
- partMapper = new vtkDataSetMapper();\r
- partMapper.SetInput(actorPData);\r
- partMapper.ScalarVisibilityOn();\r
- actorP.SetMapper(partMapper);\r
- partMapper.Delete();\r
- \r
- \r
- actorXData.Delete();\r
- actorYData.Delete();\r
- actorZData.Delete();\r
- actorXYData.Delete();\r
- actorXZData.Delete();\r
- actorYZData.Delete();\r
- actorPData.Delete();\r
- \r
- parts.add(actorX);\r
- parts.add(actorY);\r
- parts.add(actorZ);\r
- parts.add(actorXY);\r
- parts.add(actorXZ);\r
- parts.add(actorYZ);\r
- parts.add(actorP);\r
- }\r
- return parts;\r
- }\r
- \r
- public int getTranslateAxis(vtkActor actor) {\r
- if (actor == null)\r
- return -1;\r
- return parts.indexOf(actor);\r
- }\r
- \r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g3d.vtk.gizmo;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import vtk.vtkActor;
+import vtk.vtkDataSetMapper;
+import vtk.vtkPoints;
+import vtk.vtkPolyData;
+import vtk.vtkProp;
+import vtk.vtkTriangle;
+
+public class TranslateGizmo extends vtkGizmo {
+
+
+
+ private List<vtkProp> parts;
+
+ @Override
+ public Collection<vtkProp> getGizmo() {
+ if (parts == null) {
+ parts = new ArrayList<vtkProp>();
+
+
+ float size = 2.f;
+ float sizeD2 = 1.f;
+ float offset = 0.2f;
+
+ double[] colorX = new double[]{0.5,0.0,0.0};
+ double[] colorY = new double[]{0.0,0.5,0.0};
+ double[] colorZ = new double[]{0.0,0.0,0.5};
+
+ double[] colorXY = add(colorX, colorY);
+ double[] colorXZ = add(colorX, colorZ);
+ double[] colorYZ = add(colorY, colorZ);
+ double[] colorP = add(colorX,colorY,colorZ);
+
+ vtkActor actorX = new vtkActor();
+ vtkActor actorY = new vtkActor();
+ vtkActor actorZ = new vtkActor();
+ vtkActor actorXY = new vtkActor();
+ vtkActor actorXZ = new vtkActor();
+ vtkActor actorYZ = new vtkActor();
+ vtkActor actorP = new vtkActor();
+
+ actorX.GetProperty().SetColor(colorX);
+ actorY.GetProperty().SetColor(colorY);
+ actorZ.GetProperty().SetColor(colorZ);
+ actorXY.GetProperty().SetColor(colorXY);
+ actorXZ.GetProperty().SetColor(colorXZ);
+ actorYZ.GetProperty().SetColor(colorYZ);
+ actorP.GetProperty().SetColor(colorP);
+
+ actorX.GetProperty().SetOpacity(0.5);
+ actorY.GetProperty().SetOpacity(0.5);
+ actorZ.GetProperty().SetOpacity(0.5);
+ actorXY.GetProperty().SetOpacity(0.5);
+ actorXZ.GetProperty().SetOpacity(0.5);
+ actorYZ.GetProperty().SetOpacity(0.5);
+ actorP.GetProperty().SetOpacity(0.5);
+
+ actorX.GetProperty().BackfaceCullingOff();
+ actorY.GetProperty().BackfaceCullingOff();
+ actorZ.GetProperty().BackfaceCullingOff();
+ actorXY.GetProperty().BackfaceCullingOff();
+ actorXZ.GetProperty().BackfaceCullingOff();
+ actorYZ.GetProperty().BackfaceCullingOff();
+ actorP.GetProperty().BackfaceCullingOff();
+
+ actorX.SetPickable(1);
+ actorY.SetPickable(1);
+ actorZ.SetPickable(1);
+ actorXY.SetPickable(1);
+ actorXZ.SetPickable(1);
+ actorYZ.SetPickable(1);
+ actorP.SetPickable(1);
+
+
+ actorX.GetProperty().LightingOff();
+ actorY.GetProperty().LightingOff();
+ actorZ.GetProperty().LightingOff();
+ actorXY.GetProperty().LightingOff();
+ actorXZ.GetProperty().LightingOff();
+ actorYZ.GetProperty().LightingOff();
+ actorP.GetProperty().LightingOff();
+
+
+ vtkTriangle triangle = new vtkTriangle();
+
+ // X
+ vtkPolyData actorXData = new vtkPolyData();
+ actorXData.Allocate(6, 6);
+
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 1);
+ triangle.GetPointIds().SetId(2, 3);
+ actorXData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 1);
+ triangle.GetPointIds().SetId(1, 2);
+ triangle.GetPointIds().SetId(2, 3);
+ actorXData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 3);
+ triangle.GetPointIds().SetId(2, 5);
+ actorXData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 3);
+ triangle.GetPointIds().SetId(1, 4);
+ triangle.GetPointIds().SetId(2, 5);
+ actorXData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+
+ vtkPoints partPoints = new vtkPoints();
+ partPoints.InsertPoint(0, new double[]{size,0.,0.});
+ partPoints.InsertPoint(1, new double[]{size-offset,offset,0.});
+ partPoints.InsertPoint(2, new double[]{sizeD2-offset,offset,0.});
+ partPoints.InsertPoint(3, new double[]{sizeD2,0.,0.});
+ partPoints.InsertPoint(4, new double[]{sizeD2-offset,0.,offset});
+ partPoints.InsertPoint(5, new double[]{size-offset,0.,offset});
+ actorXData.SetPoints(partPoints);
+ partPoints.Delete();
+
+ // Y
+ vtkPolyData actorYData = new vtkPolyData();
+ actorYData.Allocate(6, 6);
+
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 1);
+ triangle.GetPointIds().SetId(2, 3);
+ actorYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 1);
+ triangle.GetPointIds().SetId(1, 2);
+ triangle.GetPointIds().SetId(2, 3);
+ actorYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 3);
+ triangle.GetPointIds().SetId(2, 5);
+ actorYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 3);
+ triangle.GetPointIds().SetId(1, 4);
+ triangle.GetPointIds().SetId(2, 5);
+ actorYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+
+ partPoints = new vtkPoints();
+ partPoints.InsertPoint(0, new double[]{0., size, 0.});
+ partPoints.InsertPoint(1, new double[]{offset, size - offset, 0.});
+ partPoints.InsertPoint(2, new double[]{offset, sizeD2 - offset, 0.});
+ partPoints.InsertPoint(3, new double[]{0., sizeD2, 0.});
+ partPoints.InsertPoint(4, new double[]{0., sizeD2 - offset, offset});
+ partPoints.InsertPoint(5, new double[]{0., size - offset, offset});
+ actorYData.SetPoints(partPoints);
+ partPoints.Delete();
+
+ // Z
+ vtkPolyData actorZData = new vtkPolyData();
+ actorZData.Allocate(6, 6);
+
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 1);
+ triangle.GetPointIds().SetId(2, 3);
+ actorZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 1);
+ triangle.GetPointIds().SetId(1, 2);
+ triangle.GetPointIds().SetId(2, 3);
+ actorZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 3);
+ triangle.GetPointIds().SetId(2, 5);
+ actorZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 3);
+ triangle.GetPointIds().SetId(1, 4);
+ triangle.GetPointIds().SetId(2, 5);
+ actorZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+
+ partPoints = new vtkPoints();
+ partPoints.InsertPoint(0, new double[]{0., 0.,size});
+ partPoints.InsertPoint(1, new double[]{offset, 0., size - offset});
+ partPoints.InsertPoint(2, new double[]{offset, 0., sizeD2 - offset});
+ partPoints.InsertPoint(3, new double[]{0., 0., sizeD2});
+ partPoints.InsertPoint(4, new double[]{0., offset, sizeD2 - offset});
+ partPoints.InsertPoint(5, new double[]{0., offset, size - offset});
+ actorZData.SetPoints(partPoints);
+ partPoints.Delete();
+
+ // XY
+ vtkPolyData actorXYData = new vtkPolyData();
+ actorXYData.Allocate(4, 4);
+
+ triangle.GetPointIds().SetId(0, 2);
+ triangle.GetPointIds().SetId(1, 1);
+ triangle.GetPointIds().SetId(2, 3);
+ actorXYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 1);
+ triangle.GetPointIds().SetId(2, 3);
+ actorXYData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+
+ partPoints = new vtkPoints();
+ partPoints.InsertPoint(0, new double[]{offset, size-offset, 0.f});
+ partPoints.InsertPoint(1, new double[]{offset, sizeD2 - offset, 0.f});
+ partPoints.InsertPoint(2, new double[]{sizeD2 - offset, offset, 0.f});
+ partPoints.InsertPoint(3, new double[]{size-offset, offset, 0.f});
+ actorXYData.SetPoints(partPoints);
+ partPoints.Delete();
+
+ // XZ
+ vtkPolyData actorXZData = new vtkPolyData();
+ actorXZData.Allocate(4, 4);
+
+ triangle.GetPointIds().SetId(0, 2);
+ triangle.GetPointIds().SetId(1, 1);
+ triangle.GetPointIds().SetId(2, 3);
+ actorXZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 1);
+ triangle.GetPointIds().SetId(2, 3);
+ actorXZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+
+ partPoints = new vtkPoints();
+ partPoints.InsertPoint(0, new double[]{offset, 0.f, size-offset});
+ partPoints.InsertPoint(1, new double[]{offset, 0.f, sizeD2 - offset});
+ partPoints.InsertPoint(2, new double[]{sizeD2 - offset, 0.f, offset});
+ partPoints.InsertPoint(3, new double[]{size-offset, 0.f, offset});
+ actorXZData.SetPoints(partPoints);
+ partPoints.Delete();
+
+ // YZ
+ vtkPolyData actorYZData = new vtkPolyData();
+ actorYZData.Allocate(4, 4);
+
+ triangle.GetPointIds().SetId(0, 2);
+ triangle.GetPointIds().SetId(1, 1);
+ triangle.GetPointIds().SetId(2, 3);
+ actorYZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 1);
+ triangle.GetPointIds().SetId(2, 3);
+ actorYZData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+
+ partPoints = new vtkPoints();
+ partPoints.InsertPoint(0, new double[]{0.f,offset, size-offset});
+ partPoints.InsertPoint(1, new double[]{0.f,offset, sizeD2 - offset});
+ partPoints.InsertPoint(2, new double[]{0.f,sizeD2 - offset, offset});
+ partPoints.InsertPoint(3, new double[]{0.f,size-offset, offset});
+
+ actorYZData.SetPoints(partPoints);
+ partPoints.Delete();
+
+ vtkPolyData actorPData = new vtkPolyData();
+ actorPData.Allocate(10, 10);
+
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 1);
+ triangle.GetPointIds().SetId(2, 2);
+ actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 2);
+ triangle.GetPointIds().SetId(2, 3);
+ actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 3);
+ triangle.GetPointIds().SetId(2, 4);
+ actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 4);
+ triangle.GetPointIds().SetId(2, 5);
+ actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 5);
+ triangle.GetPointIds().SetId(2, 6);
+ actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 6);
+ triangle.GetPointIds().SetId(2, 7);
+ actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 7);
+ triangle.GetPointIds().SetId(2, 8);
+ actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 8);
+ triangle.GetPointIds().SetId(2, 9);
+ actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+ triangle.GetPointIds().SetId(0, 0);
+ triangle.GetPointIds().SetId(1, 9);
+ triangle.GetPointIds().SetId(2, 1);
+ actorPData.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds());
+
+ partPoints = new vtkPoints();
+ partPoints.InsertPoint(0, new double[]{0.f, 0.f, 0.f});
+ partPoints.InsertPoint(1, new double[]{sizeD2, 0.f, 0.f});
+ partPoints.InsertPoint(2, new double[]{sizeD2 - offset, offset, 0.f});
+ partPoints.InsertPoint(3, new double[]{offset, sizeD2 - offset, 0.f});
+ partPoints.InsertPoint(4, new double[]{0.f, sizeD2, 0.f});
+ partPoints.InsertPoint(5, new double[]{0.f, sizeD2 - offset, offset});
+ partPoints.InsertPoint(6, new double[]{0.f, offset, sizeD2-offset});
+ partPoints.InsertPoint(7, new double[]{0.f, 0.f, sizeD2});
+ partPoints.InsertPoint(8, new double[]{offset, 0.f, sizeD2-offset});
+ partPoints.InsertPoint(9, new double[]{sizeD2-offset, 0.f, offset});
+ actorPData.SetPoints(partPoints);
+ partPoints.Delete();
+
+
+ vtkDataSetMapper partMapper = new vtkDataSetMapper();
+ partMapper.SetInputData(actorXData);
+ partMapper.ScalarVisibilityOn();
+ actorX.SetMapper(partMapper);
+ partMapper.Delete();
+
+ partMapper = new vtkDataSetMapper();
+ partMapper.SetInputData(actorYData);
+ partMapper.ScalarVisibilityOn();
+ actorY.SetMapper(partMapper);
+ partMapper.Delete();
+
+ partMapper = new vtkDataSetMapper();
+ partMapper.SetInputData(actorZData);
+ partMapper.ScalarVisibilityOn();
+ actorZ.SetMapper(partMapper);
+ partMapper.Delete();
+
+ partMapper = new vtkDataSetMapper();
+ partMapper.SetInputData(actorXYData);
+ partMapper.ScalarVisibilityOn();
+ actorXY.SetMapper(partMapper);
+ partMapper.Delete();
+
+ partMapper = new vtkDataSetMapper();
+ partMapper.SetInputData(actorXZData);
+ partMapper.ScalarVisibilityOn();
+ actorXZ.SetMapper(partMapper);
+ partMapper.Delete();
+
+ partMapper = new vtkDataSetMapper();
+ partMapper.SetInputData(actorYZData);
+ partMapper.ScalarVisibilityOn();
+ actorYZ.SetMapper(partMapper);
+ partMapper.Delete();
+
+ partMapper = new vtkDataSetMapper();
+ partMapper.SetInputData(actorPData);
+ partMapper.ScalarVisibilityOn();
+ actorP.SetMapper(partMapper);
+ partMapper.Delete();
+
+
+ actorXData.Delete();
+ actorYData.Delete();
+ actorZData.Delete();
+ actorXYData.Delete();
+ actorXZData.Delete();
+ actorYZData.Delete();
+ actorPData.Delete();
+
+ parts.add(actorX);
+ parts.add(actorY);
+ parts.add(actorZ);
+ parts.add(actorXY);
+ parts.add(actorXZ);
+ parts.add(actorYZ);
+ parts.add(actorP);
+ }
+ return parts;
+ }
+
+ public int getTranslateAxis(vtkActor actor) {
+ if (actor == null)
+ return -1;
+ return parts.indexOf(actor);
+ }
+
+
+}