Complete list points

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
tal
Posts: 84
Joined: Thu Jul 02, 2009 3:27 pm

Complete list points

Post by tal » Tue Apr 13, 2010 10:24 am

Hi,

I have a polygon defined with 10 points, but I want to have have all the points pixel by pixel ( 110,120 111,120, 112.....).
Have you an idea how I could make this?

Thanks

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Complete list points

Post by Klaus » Tue Apr 13, 2010 10:55 am

Hi Tal,

I have no idea what you want, but maybe getting/setting the points of a graphic is what you are after? :)
Check "points" in the docs (Rev Dictionary).


Best

Klaus

tal
Posts: 84
Joined: Thu Jul 02, 2009 3:27 pm

Re: Complete list points

Post by tal » Tue Apr 13, 2010 2:18 pm

Hi,
If you make

Code: Select all

 put the points of grc "test" 
, you will have a list of points....

But this list will not contain al the pixels, for example :

the result of the previous instruction for my polygon will be :

630,464
630,315
636,297
648,287


But my polygon does not contain only 4 points, i want to have the complete list and I wanted to know if there was an easy way to get this.

Thanks

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Complete list points

Post by FourthWorld » Tue Apr 13, 2010 2:23 pm

Are you referencing the correct object? In 12 years I've never seen a problem obtaining the points of a polygon.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Complete list points

Post by bn » Tue Apr 13, 2010 2:55 pm

Hi tal,

if you want all the intermediate points, the ones between the corners of your list then you have to calculate them. What do you want to do with the points?
regards
Bernd

tal
Posts: 84
Joined: Thu Jul 02, 2009 3:27 pm

Re: Complete list points

Post by tal » Tue Apr 13, 2010 3:22 pm

Hi bn,

I want them cause I want to place an object on a specific point of the polygon :
- I have a group and I want to place an object on the border of the group, which can be a polygon or an oval , not only rectangle ( only the border, which delimitate the group)
- So I click on the group, and the object is placed in the nearest position in the border of the group.
- And then I can move the object I placed, but its move will be constrain to the points of the polygon.

Hope you understood what I explained

Thanks

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Complete list points

Post by bn » Tue Apr 13, 2010 5:56 pm

tal,
for the oval this stack by Jim James Hurley might be helpful (attached below). It constructs the points of an ellipse and lets you move an object manually along those points. There is no way to get the points of an oval from a Rev graphic, as far as I know.

for the polygons have a look at
http://forums.runrev.com/phpBB2/viewtop ... 68&p=20634
it is not exactly what you want but has some of the math you need.

let us know how it goes.
regards
Bernd

Edit: uploaded improved version of file
Attachments
BallsOnAnEllipse.rev.zip
(5.56 KiB) Downloaded 402 times
Last edited by bn on Wed Apr 14, 2010 6:07 pm, edited 1 time in total.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Complete list points

Post by bn » Tue Apr 13, 2010 10:21 pm

tal,

I did a little stack that gives you all the intermediate points of a polygon graphic. It is attached below. Should do the trick. Not extensively tested. Tell us how it works.
regards
Bernd
Attachments
calculate points of polygon.rev.zip
(4.85 KiB) Downloaded 386 times

tal
Posts: 84
Joined: Thu Jul 02, 2009 3:27 pm

Re: Complete list points

Post by tal » Wed Apr 14, 2010 5:47 pm

Thank you bn,

For the eclipse I have the error (divide by zero), but for your application it works good.

See you

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Complete list points

Post by bn » Wed Apr 14, 2010 6:10 pm

tal,

I uploaded an improved version of BallsOnAnEllipse in the original post. It should work now without initializing it by drawing the ellipse first.
The button "Draw Ellipse" contains the code that makes the actual ellipse, which is what interests you.
regards
Bernd

Post Reply