C, 359 Chars
My first attempt at golfing. At least it beats the Java solution ;-)
int r,n,l,g,i,j,x,y;char* b;float a,c,u,z,p,q,s,t;main(int j,char**v){r=atoi(v[1]);b=malloc(g=(l=r*2+1)*r*2+1);memset(b,32,g);for(j=g-2;j>0;j-=l){b[j]='\n';}b[g-1]=0;a=2*3.14/(n=atoi(v[2]));for(;i<=n;i++,p=s,q=t){c=i*a;s=sin(c)*r+r;t=cos(c)*r+r;if(i>0){u=(s-p)/r,z=(t-q)/r;for(j=0;j<r;j++){x=p+u*j;y=q+z*j;if(x>=0&&y>=0&&y<r*2&&x<l-1)b[y*l+x]='#';}}}puts(b);}
ungolfed:
int r,n,l,g,i,j,x,y;
char* b;
float a,c,u,z,p,q,s,t;
main(int j,char**v){
r=atoi(v[1]);
b=malloc(g=(l=r*2+1)*r*2+1);
memset(b,32,g);
for(j=g-2;j>0;j-=l){b[j]='\n';}
b[g-1]=0;
a=2*3.14/(n=atoi(v[2]));
for(;i<=n;i++,p=s,q=t){
c=i*a;s=sin(c)*r+r;t=cos(c)*r+r;
if(i>0){
u=(s-p)/r,z=(t-q)/r;
for(j=0;j<r;j++){
x=p+u*j;y=q+z*j;
if(x>=0&&y>=0&&y<r*2&&x<l-1)b[y*l+x]='#';
}
}
}
puts(b);
}
And it's the only program that outputs the polygon in ASCII instead of drawing it. Because of this and some floating point rounding issues, the output doesn't look particularly pretty (ASCII Chars are not as high as wide).
######
### ###
#### ####
### ###
### ####
### ###
# #
# ##
# #
# #
## ##
# #
## ##
# #
# #
## ##
# #
## ##
# #
# #
# #
# #
## ##
# #
## ##
# #
# #
## ##
# #
## ##
# #
# #
# ##
# #
### ###
### ####
### ###
### ####
### ###
######
What should the polygon look like? Why should the side length defined by the relationship above ^^ always be an integer? Please clarify, – Erik the Outgolfer – 2016-09-16T22:19:38.273
3What is the radius of a polygon? The radius of its incircle? Its outcircle? – Peter Taylor – 2014-04-16T07:25:53.350
There. I fixed it. Sorry about that :P. – Taconut – 2014-04-16T13:49:18.193
2
@PeterTaylor The radius of a regular polygon is the distance to any vertex (radius outcircle or circumradius). The incircle's radius(or distance to sides) is called the apothem. This shouldn't be "unclear what you're asking", since it has an easily found definition (#1 result for "radius of a polygon" on google).
– Geobits – 2014-04-16T13:57:21.907@Geobits I agree, but I still edited it anyway. – Taconut – 2014-04-16T14:03:09.837
@PeterTaylor I'll tag it as both then :I – Taconut – 2014-04-16T14:03:40.270
@Taconut It would become a better challenge if you take length of one side as second input instead of radius. – Mukul Kumar – 2014-04-16T16:24:17.393
@MukulKumar
radius=length/(2*sin(180/sides))
? (Or pi rather than 180 if using radians) – Geobits – 2014-04-16T17:55:05.823@Geobits oops! just forgot that kind of relationship! – Mukul Kumar – 2014-04-17T01:47:45.463