WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   how to draw a line on the 2D screen with mouse (https://forum.worldviz.com/showthread.php?t=5221)

aaaa 11-08-2014 06:40 AM

how to draw a line on the 2D screen with mouse
 
in the 2D screen, I want to draw a line. One point of the line is given, for example (400,500,0), the other point of the line is where the click of the mouse.

since the coordinate range of the mouse is [0,1], while the coordinate range of the point of the line is determinated by the resolution of the screen. How to make sure the other end of the line is the point where the mouse clicks?

Frank Verberne 11-10-2014 05:32 AM

To get the coordinate in window pixels or screen pixels, use:
Code:

# Get mouse position in pixel coordinates
x,y = viz.mouse.getPosition(viz.WINDOW_PIXELS)
# Get mouse position in screen coordinates
x,y = viz.mouse.getPosition(viz.SCREEN_PIXELS)

More info: http://docs.worldviz.com/vizard/Mouse.htm.


All times are GMT -7. The time now is 08:46 PM.

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