WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Screen Size and Scaling (https://forum.worldviz.com/showthread.php?t=4542)

javadi 04-02-2013 05:26 PM

Screen Size and Scaling
 
2 Attachment(s)
Hi,

I have two questions regarding screen size and scaling of objects. Here I have attached two images (one original texture and one screen shot of the texture placed in two orientations). I have also annotated the screen shot for clarification. I have two issues,
  1. In order to achieve an equal width of arrows (green lines in the screen shot), I have to adjust the window size to something like [760, 600]. How can I calculate these values? Further information regarding the size of the original texture and my display setting is gone in the bottom.
  2. My other issue is the ratio of width to height of the texture (green to blue lines in the screen shot). The original texture looks much slimmer than the ones displayed. I use 'setScale' method to adjust the x and y scales differently (the blue line in the code below). When we add the texture, we specify a size. For that, I use one number, which I assume it defines a square. How can I merge this scaling in the line in blue with texture size in the line in red?
Some information on the original texture and my display settings,
  • The original image: 600 x 780 pixels, 72 x 72 pixels per inch resolution
  • The display: 1920 x 1200 LCD monitor.
The code that I used to create display the arrows:
Code:

import viz

viz.window.setSize([760, 600])

viz.go()

TextureArrow = viz.addTexture('Bank, Task\Arrow, Original.png')

DispArrow1 = viz.addTexQuad(viz.SCREEN, viz.MainScene, 500)
DispArrow1.setScale([600.0 / 780, 780.0 / 780, 1])
DispArrow1.setPosition([0.7, 0.7, 0])
DispArrow1.setEuler([0, 0, 90], mode = viz.ABSOLUTE)
DispArrow1.texture(TextureArrow)

DispArrow2 = viz.addTexQuad(viz.SCREEN, viz.MainScene, 500)
DispArrow2.setScale([600.0 / 780, 780.0 / 780, 1])
DispArrow2.setPosition([0.5, 0.3, 0])
DispArrow2.setEuler([0, 0, 0], mode = viz.ABSOLUTE)
DispArrow2.texture(TextureArrow)

Very many thanks for your attention.

Greetings,

farshizzo 04-02-2013 05:38 PM

I would recommend adding the arrow to the viz.ORTHO layer, instead of viz.SCREEN. The SCREEN layer works in normalized (0-1) units, which is what causes the aspect ratio distortions. The ORTHO layer works in pixel units, which preserves the objects aspect ratio.

javadi 04-02-2013 05:56 PM

Quote:

Originally Posted by farshizzo (Post 14778)
I would recommend adding the arrow to the viz.ORTHO layer, instead of viz.SCREEN. The SCREEN layer works in normalized (0-1) units, which is what causes the aspect ratio distortions. The ORTHO layer works in pixel units, which preserves the objects aspect ratio.

Thanks for your prompt reply. It works. I only need to resize everything proportional to the size of the window, which should be fine.

Cheers


All times are GMT -7. The time now is 03:39 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC