[vtkusers] how to draw with exact physical dimension (on screen)

David Gobbi david.gobbi at gmail.com
Fri Jun 6 17:33:46 EDT 2014


Hi Elvis,

You can only get it "perfect" if you are doing a parallel projection,
in which case you set the ParallelScale according to the known
physical height of the window.

For perspective, the best you can do is make objects at the focal
point appear to be the right size.  To do this, consider that the
Distance multiplied by half of the sine of the ViewAngle corresponds
to half of the hight of the window.  Basic high-school trigonometry,
in other words ;)

  David

On Fri, Jun 6, 2014 at 3:18 PM, Elvis Chen <elvis.chen at gmail.com> wrote:
> hi David/Maarten,
>
> sounds like we have a Queen's/Robarts reunion :)
>
> let say if I know (from manufacturer's specification) the exact size of the
> pixel, is there a way to do this in VTK?  I guess I can try to set the
> camera's position (with respect to the imaging plane) to get the correct
> zoom factor, so the drawn object would appear as the correct/physical size.
> I haven't tried this, just want to throw this idea out.
>
> any other suggestions?
>
> thanks!
>
>
>
> On Fri, Jun 6, 2014 at 11:17 AM, Maarten Beek <beekmaarten at yahoo.com> wrote:
>>
>> I quickly checked Qt, there are functions (e.g.:
>> QPaintDevice::heightMM()), but the docs also say it is inaccurate.
>>
>> Maarten
>>
>>
>> On Friday, June 6, 2014 8:58:58 AM, David Gobbi <david.gobbi at gmail.com>
>> wrote:
>>
>>
>> Hi Elvis,
>>
>> I've tried doing this in the past, but the pixel sizes reported by the
>> operating
>> system are only approximate and are sometimes wildly inaccurate.  VTK
>> itself has no way of retrieving this information, as far as I am aware.
>>
>> In the end, I just applied a ruler to the screen :)
>>
>>   David
>>
>>
>>
>> On Thu, Jun 5, 2014 at 7:17 AM, Elvis Chen <elvis.chen at gmail.com> wrote:
>> > hi all,
>> >
>> > Is there a way to draw a geometrical objects that will show up on the
>> > screen
>> > with known physical dimension in vtk?
>> >
>> > That is, say if I want to draw a square of 5cm in dimension, and I want
>> > it
>> > to appear on screen as a square of 5cm^2, how do I specify vtkCamera
>> > that
>> > takes the screen pixel dimension into consideration?
>> >
>> > or am I in the wrong track by looking into vtkCamera?
>> >
>> > any help is very much appreciated,
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>


More information about the vtkusers mailing list