[vtkusers] Obtain a mesh orthographic projections

Bruno Cafaro cafaro at dis.uniroma1.it
Fri Sep 12 06:02:38 EDT 2014


Dear vtkUsers,
sorry to send this again, but I wrongly sent the last message as a reply. If 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/20140912/eff6cf0d/attachment-0003.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/20140912/eff6cf0d/attachment-0004.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/20140912/eff6cf0d/attachment-0005.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