[vtkusers] Orthographic projection onto arbitrary plane
David Gobbi
david.gobbi at gmail.com
Thu May 31 16:26:37 EDT 2018
The camera also has a SetViewShear() method you might find useful:
camera.SetViewShear(0.1, 0.1, 0.0)
- David
On Thu, May 31, 2018 at 2:21 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi Sebastien,
>
> So your goal is to make VTK do an orthographic projection instead of
> a perspective projection? If so then you don't have to build your own
> transform, the camera has an orthographic mode that it calls the
> "ParallelProjection" mode:
>
> camera = renderer.GetActiveCamera()
> camera.ParallelProjectionOn()
> camera.SetParallelScale(500.0) # tweak as needed
>
> Set the camera pose in the usual way:
>
> camera.SetFocalPoint(0.0, 0.0, 0.0)
> camera.Position(0.0, 0.0, -500.0)
> camera.SetViewUp(0.0, 1.0, 0.0)
>
> Hope this helps.
>
> - David
>
>
>
> On Thu, May 31, 2018 at 8:49 AM, smurphy <sebastien.murphy at gmail.com>
> wrote:
>
>> Hello,
>>
>> I am (desperately) trying to make an orthographic projection in a plane
>> of a
>> geometry (see picture attached).
>> The only help I can find online is this thread so I am replying to this
>> old
>> post.
>> I tried to do the following code but without success. It simply place the
>> camera in the correct position but does not actually make the
>> transformation. Am I missing a line, should I pass the transform to the
>> camera in a certain way?
>> Thanks a lot,
>> Sebastien
>>
>> #center of the geometry volume is 0,0, -500
>> FocalPoint=[0,0,-500]
>> Position=[0,0,-500]
>> ViewUp=[0,0,-500]
>> Transform=vtk.vtkPerspectiveTransform()
>> Transform.SetupCamera(Position, FocalPoint, ViewUp)
>> Transform.Ortho(-1000,1000,-1500,1500,-500,500)
>> <http://vtk.1045678.n5.nabble.com/file/t342442/Screen_Shot_2
>> 018-05-31_at_16.png>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180531/a25b0f3d/attachment.html>
More information about the vtkusers
mailing list