dbTalk Databases Forums  

Get polygon vertices from its radius

comp.databases.mysql comp.databases.mysql


Discuss Get polygon vertices from its radius in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
shashi kanth
 
Posts: n/a

Default Get polygon vertices from its radius - 03-07-2011 , 12:26 AM






Hi, this may sound ridiculuos but i want to know how can i insert a
polygon into database, if i only know the radius of the polygon.

Like i have a polygon, centered at the origin, with radius, say 5. Now
how can i insert it into mysql database? I hope we need to know the
vertices of it before inserting.

How can this be achieved.

Reply With Quote
  #2  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: Get polygon vertices from its radius - 03-07-2011 , 02:38 AM






On 2011-03-07 07:26, shashi kanth wrote:
Quote:
Hi, this may sound ridiculuos but i want to know how can i insert a
polygon into database, if i only know the radius of the polygon.

No, you will need more information. If the polygon is regular you will
need the origin and the number of vertices. If it is not regular, I'm
not sure what radius is supposed to mean.

/Lennart


[...]

Reply With Quote
  #3  
Old   
shashi kanth
 
Posts: n/a

Default Re: Get polygon vertices from its radius - 03-07-2011 , 02:45 AM



Yes, the polygon will be a regular one, with a point of origin, like
(10,10) and with a radius. Also the number of vertices or the number
of sides can be provided. In such a case, how can i go ahead

Reply With Quote
  #4  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: Get polygon vertices from its radius - 03-07-2011 , 03:05 AM



On 2011-03-07 09:45, shashi kanth wrote:
Quote:
Yes, the polygon will be a regular one, with a point of origin, like
(10,10) and with a radius. Also the number of vertices or the number
of sides can be provided. In such a case, how can i go ahead
Oh I forgot, you will for example need an angle for one of the vertices.
Otherwise you will have many possible vertice collections. Given that
you can calculate the vertices, and store them as a polygon.

I'm not a gis-user so there may be a function that takes these kind of
arguments and creates a polygon for you, but my guess is that you will
have to do some math in the application, and create the polygon your self.


/Lennart

Reply With Quote
  #5  
Old   
Doug Miller
 
Posts: n/a

Default Re: Get polygon vertices from its radius - 03-07-2011 , 05:59 AM



In article <ad785d6c-51e5-4365-b303-9b647c526da3 (AT) j9g2000prj (DOT) googlegroups.com>, shashi kanth <dskanth.99 (AT) gmail (DOT) com> wrote:
Quote:
Hi, this may sound ridiculuos but i want to know how can i insert a
polygon into database, if i only know the radius of the polygon.
Knowing only the radius, and not the number of sides and their lengths?
Impossible.

Quote:
Like i have a polygon, centered at the origin, with radius, say 5. Now
how can i insert it into mysql database? I hope we need to know the
vertices of it before inserting.
Yes, of course you need to know the vertices.
Quote:
How can this be achieved.
First, determine how many sides there are...

Reply With Quote
  #6  
Old   
Doug Miller
 
Posts: n/a

Default Re: Get polygon vertices from its radius - 03-07-2011 , 06:03 AM



In article <5882e7af-a65c-4433-9240-6f2b002c39d7 (AT) w9g2000prg (DOT) googlegroups.com>, shashi kanth <dskanth.99 (AT) gmail (DOT) com> wrote:
Quote:
Yes, the polygon will be a regular one, with a point of origin, like
(10,10) and with a radius. Also the number of vertices or the number
of sides can be provided. In such a case, how can i go ahead
You still need to specify the position of one vertex, else you will have an
infinite number of possible rotations for the polygon. Calculating the
positions of the remaining vertices is a straightforward exercise in
trigonometry, which is off-topic for comp.databases.mysql.

Try posting in alt.algebra.help or in one of the geometry.* newsgroups.

Reply With Quote
  #7  
Old   
strawberry
 
Posts: n/a

Default Re: Get polygon vertices from its radius - 03-07-2011 , 07:32 AM



Just to extend upon what Doug has mentioned; you would need to know the centre, the number of sides, and at least one vertex. The radius would not then be required.

Also, see etiquette regards cross-posting vs multi-posting.

Reply With Quote
  #8  
Old   
shashi kanth
 
Posts: n/a

Default Re: Get polygon vertices from its radius - 03-07-2011 , 11:06 PM



Thanks for your replies... let me see how far i could solve it.

Reply With Quote
  #9  
Old   
Gordon Burditt
 
Posts: n/a

Default Re: Get polygon vertices from its radius - 03-08-2011 , 11:43 AM



Quote:
Hi, this may sound ridiculuos but i want to know how can i insert a
polygon into database, if i only know the radius of the polygon.

Like i have a polygon, centered at the origin, with radius, say 5. Now
how can i insert it into mysql database? I hope we need to know the
vertices of it before inserting.

How can this be achieved.
Assuming:
- It's a regular polygon.
- The center is at (0,0).
- The radius of a polygon is the distance from the center to a vertex
(as opposed to the distance from the center to the closest point on
a side).
- One of the vertices is at (0,r) relative to the center.

Then in polar coordinates, all of the vertexes are distance r from
the origin. For an N-sided regular polygon, the angles are at
k*360/N degrees, where k varies from 0 to N-1. If one of the
vertices is at an arbitrary angle theta, add this to the angle for
each of the vertices, then reduce modulo 360 degrees.

Now convert to rectangular coordinates. If the center is not at
(0,0), add the coordinates of the center to each of the vertices.

Reply With Quote
  #10  
Old   
shashi kanth
 
Posts: n/a

Default Re: Get polygon vertices from its radius - 03-08-2011 , 11:38 PM



Thanks for the reply, but i am still confused with this... i have
posted my question here:
http://stackoverflow.com/questions/5...certain-radius

Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.