It is currently Sat Apr 29, 2017 2:24 pm



Welcome
Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: P168 Gr.bounded.touch touched, left, top, right, bottom
Unread postPosted: Thu Mar 23, 2017 12:48 pm 
Offline

Joined: Sat Mar 11, 2017 5:49 am
Posts: 28
Maybe i am missing something, but in the manua! It says:

If the parameters that you used in Gr.scale were scale_x and scale_y (Gr.scale scale_x, scale_y) then divide left and right by scale_x and divide top and bottom by scale_y.

gr.open 255, 0, 0, 0
gr.orientation 1
gr.screen w,h
scx = 1000
scy = 1400
sx = w/scx
sy = h/scy
gr.scale sx,sy
gr.color 255,255,255,255,1
gr.rect p,115,680,375,780
gr.render
do
gr.bounded.touch F, 115*sx,680*sy,375*sx,780*sy
until F
But this code only works , the way posted here
So i multiply instead of divide

Regards
Danny


Top
 Profile  
 
 Post subject: Re: P168 Gr.bounded.touch touched, left, top, right, bottom
Unread postPosted: Tue Mar 28, 2017 12:48 am 
Offline

Joined: Wed Oct 03, 2012 9:53 am
Posts: 2795
Location: Colorado, U.S.
I agree. Thank you for reporting this case.

There has been some confusion on this subject before. For example, see this topic. It's about GR.Touch, which returns real coordinates. You need to convert them to virtual screen coordinates so you divide by the scale factor.

Your comment is about GR.Bounded.Touch. The two commands have nearly identical syntax:
[command] [flag] [list of real screen coordinates]
But in fact they are very different from each other:
GR.Touch coordinates are outputs.
GR.Bounded.Touch coordinates are inputs.

Both commands work with real screen coordinates, but GR.Scale allows programs to use virtual screen coordinates.
- Scale factor is defined as the ratio of real to virtual: sf = xr / xv
- To use the real coordinates returned by GR.Touch, you must divide them by the scale factor to get the virtual coordinates: xv = xr / sv
- To provide real coordinates as inputs to GR.Bounded.Touch, you must multiply your virtual coordinates by the scale factor: xr= xv * sv

The algebra is simple, but the English is confusing. In the linked topic, humpty reported that the GR.Touch entry was wrong, so I fixed it. It didn't occur to me, or apparently to anyone else, to check the inverse case to see if it was wrong, too. It was, but it's not obvious from the syntax that it is the inverse case!

Whatever, it will be better in the next release.

- Marc


Top
 Profile  
 
 Post subject: Re: P168 Gr.bounded.touch touched, left, top, right, bottom
Unread postPosted: Tue Mar 28, 2017 10:45 am 
Offline

Joined: Sat Mar 11, 2017 5:49 am
Posts: 28
Hi marc

Thanks for the clear explanation.

Regards
Danny


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
suspicion-preferred