WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-08-2014, 06:40 AM
aaaa aaaa is offline
Member
 
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
  #2  
Old 11-10-2014, 05:32 AM
Frank Verberne Frank Verberne is offline
Member
 
Join Date: Mar 2008
Location: Netherlands
Posts: 148
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.
Reply With Quote
Reply

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 03: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 03:11 PM
Draw line with a triangle at the end Chrissy2009 Vizard 9 08-24-2009 11:12 AM
Draw Line between Points Chrissy2009 Vizard 2 05-13-2009 04:42 AM
Draw Line between Points selected by mouse Johannes Vizard 7 01-07-2005 02:50 PM


All times are GMT -7. The time now is 09:29 AM.


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