WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   orthographic projection question (https://forum.worldviz.com/showthread.php?t=5849)

flatland 09-15-2016 12:53 PM

orthographic projection question
 
Hi everyone,

I'm fairly new to Vizard and am working with orthographic projection. I have a basic question. In the program below, the application window has an aspect ratio of 1, as does the width and height of the 100x100 region between the left/right/top/bottom clipping planes in the orthographic projection setup. But when I run the program, the 90x90 vertical quad centered at (0,0,0) doesn't appear centered vertically in the application window. It is slightly displaced in the downward direction, and I don't understand why. (This is causing me problems when I try to connect mouse coordinates in the application window with objects in the scene.) Anyone have an idea why this is happening?

Robin

import viz

# set application window size
viz.window.setSize( 700, 700 )

# set mainWindow
viz.MainWindow.ortho(-50,50,-50,50,-1,1)
viz.MainWindow.clearcolor( viz.BLACK )

viz.startLayer(viz.QUADS)
viz.vertexColor(1,0,0)
viz.vertex(-45, 45, 0)
viz.vertex(-45,-45, 0)
viz.vertex( 45,-45, 0)
viz.vertex( 45, 45, 0)
viz.endLayer()

viz.go()

Jeff 09-16-2016 03:36 AM

The default eyeheight is 1.82 meters. Try changing the eyeheight to 0:

Code:

viz.eyeheight(0)

flatland 09-16-2016 08:38 AM

Thank you!! That fixed it:-)

Robin


All times are GMT -7. The time now is 11:42 PM.

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