[vtkusers] Obtain a mesh orthographic projections
Bruno Cafaro
cafaro at dis.uniroma1.it
Thu Sep 11 14:00:16 EDT 2014
Dear vtkUsers,
i have a mesh, and i need to extract its orthographic projections on the
three planes 'xy', 'xz' and 'yz'.
Here is my code snippet:
void ImplicitFunctionRender::GetOrtho(float d)
{
// 'XY' plane
camera->SetPosition(0,0,d);
camera->SetViewUp(0,1,0);
camera->SetViewPlaneNormal(0,0,-1);
ImplicitFunctionRender::SavePNG(11,0);
ImplicitFunctionRender::SaveTRANSFORM4x4(11,0,camera->GetViewPlaneNormal(),camera->GetPosition(),camera->GetViewUp());
// 'YZ' plane
camera->SetPosition(0,d,0);
camera->SetViewUp(1,0,0);
camera->SetViewPlaneNormal(0,-1,0);
ImplicitFunctionRender::SavePNG(22,0);
ImplicitFunctionRender::SaveTRANSFORM4x4(22,0,camera->GetViewPlaneNormal(),camera->GetPosition(),camera->GetViewUp());
// 'XZ' plane
camera->SetPosition(d,0,0);
camera->SetViewUp(0,0,1);
camera->SetViewPlaneNormal(-1,0,0);
ImplicitFunctionRender::SavePNG(33,0);
ImplicitFunctionRender::SaveTRANSFORM4x4(33,0,camera->GetViewPlaneNormal(),camera->GetPosition(),camera->GetViewUp());
}
If I set View Up always to (0,0,1), which should be coherent with the
'z' direction, in the second case 'YZ' plane i get an empty image. First
and third are ok.
If I set View Up as in the code snippet I always have the object in the
image, it works but in the 'YZ' plane case the image is rotated 90°,
which is correct i suppose, but I want it again with 'Z' axis up....
Moreover setting or do not setting the view plane normal does not affect
the results.
I also attach my results using the code snippet reported.
Hope someone can help me understanding how this work.
Best
Bruno
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot011.png
Type: image/png
Size: 32309 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140911/99f7f66d/attachment.png>
-------------- next part --------------
Position: 0 0 7.5
View Normal: 0 0 -1
View Up: 0 1 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot022.png
Type: image/png
Size: 26164 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140911/99f7f66d/attachment-0001.png>
-------------- next part --------------
Position: 0 7.5 0
View Normal: 0 -1 0
View Up: 1 0 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot033.png
Type: image/png
Size: 24705 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140911/99f7f66d/attachment-0002.png>
-------------- next part --------------
Position: 7.5 0 0
View Normal: -1 0 0
View Up: 0 0 1
More information about the vtkusers
mailing list