Hi Marco!
The best solution I could think of is to compose the letters from the vtkAnnotatedCubeActor
with a basic cube actor of the same size with colored faces. In order to do that, you should:
-
Hide the annotated cube faces by setting it’s opacity property to
0
- Create an array to hold the six colors for the faces
- Create a actor based on the
vtkCubeSource
setting its CellData Scalars to use the color array -
Merge the
vtkAnnotatedCubeActor
and colored actor usingvtkPropAssembly
- Use the
vtkPropAssembly
output as your marker for thevtkOrientationMarkerWidget
I tried to simplify the coloring part, to avoid difficulties for you to choose what colors go in what faces:
vtkSmartPointer<vtkUnsignedCharArray> face_colors = vtkSmartPointer<vtkUnsignedCharArray>::New();
face_colors->SetNumberOfComponents(3);
unsigned char face_x_plus[3] = { 255,0,0 };
unsigned char face_x_minus[3] = { 0,255,0 };
unsigned char face_y_plus[3] = { 0,0,255 };
unsigned char face_y_minus[3] = { 255,255,0 };
unsigned char face_z_plus[3] = { 0,255,255 };
unsigned char face_z_minus[3] = { 255,0,255 };
face_colors->InsertNextTypedTuple(face_x_minus);
face_colors->InsertNextTypedTuple(face_x_plus);
face_colors->InsertNextTypedTuple(face_y_minus);
face_colors->InsertNextTypedTuple(face_y_plus);
face_colors->InsertNextTypedTuple(face_z_minus);
face_colors->InsertNextTypedTuple(face_z_plus);
Anyways, follow attached the modified example I made to test it. main.cpp (4.6 KB)
Hope this is useful.
Have a fruitful week!
Rodrigo Figueiredo.