WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 11-08-2014, 07:40 AM
aaaa aaaa is offline
Join Date: Nov 2014
Posts: 9
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?
Reply With Quote
Old 11-10-2014, 06:32 AM
Frank Verberne Frank Verberne is offline
Join Date: Mar 2008
Location: Netherlands
Posts: 148
To get the coordinate in window pixels or screen pixels, use:
# 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:
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to draw 2D line in the screen, no the in 3D screen aaaa Vizard 1 11-07-2014 04:18 PM
how to draw 2D figure , for example a circle, in the screen, no the in 3D screen aaaa Vizard 4 11-07-2014 04:11 PM
Draw line with a triangle at the end Chrissy2009 Vizard 9 08-24-2009 12:12 PM
Draw Line between Points Chrissy2009 Vizard 2 05-13-2009 05:42 AM
Draw Line between Points selected by mouse Johannes Vizard 7 01-07-2005 03:50 PM

All times are GMT -7. The time now is 01:09 PM.

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