/    Sign up×
Community /Pin to ProfileBookmark

Get polygon vertices from its radius

Hi, i have a polygon with some radius. Something like this. Now i need to

1. insert it into mysql database.
2. find whether a point lies inside or outside of the polygon. (Does it include getting the vertices of it?)

How can this be achieved? ?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMar 07.2011 — Will the polygons always be convex, or can they be concave?

[upl-file uuid=8e24c748-a095-46c4-a72d-4e7eeb309efb size=1kB]convex-concave-polygon.gif[/upl-file]
Copy linkTweet thisAlerts:
@NogDogMar 07.2011 — PS: You might want to check out some of these search results: http://www.google.com/search?q=php+point+in+polygon+algorithn.
Copy linkTweet thisAlerts:
@dskanthauthorMar 08.2011 — The polygons will be convex.

Do i need to know any other details like the number of sides of polygon, and its center of origin, for finding the vertices ?
Copy linkTweet thisAlerts:
@NogDogMar 08.2011 — I suspect that you will want to calculate the vertices. Off the top of my head I'm not sure how I would do that, other than start googling or polygon algorithms and such until I found something. ?
Copy linkTweet thisAlerts:
@blue-eye-labsMar 08.2011 — if it is a simple regular polygon this is simple (I am assuming it is since you're using a radius).

Basically, look at the polygon like a circle. Vertices are placed regularly around the circle at 2π/N radian intervals (where N is the number of sides).

In re finding is something is inside or outside, one can look at the polygon as a series of triangles with lines mappable to functions of (x,y). You can then test whether a point is inside or outside the line.

You'd have to sit down and do some maths though. Enjoy.
×

Success!

Help @dskanth spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...