## debugDrawCircle understanding...

Official forum for the Chipmunk2D Physics Library.

### debugDrawCircle understanding...

In the demo there is a debugdraw circle but when I read the code I feel like it's drawing only two triangles!

Could someone tell me what i'm missing? I thought I would see some triangle fan with a number of triangles proportional to the size of the circle...
Code: Select all
`void ChipmunkDebugDrawCircle(cpVect pos, cpFloat angle, cpFloat radius, cpSpaceDebugColor outlineColor, cpSpaceDebugColor fillColor){   Triangle *triangles = PushTriangles(2);      cpFloat r = radius + 1.0f/ChipmunkDebugDrawPointLineScale;   Vertex a = {{(GLfloat)(pos.x - r), (GLfloat)(pos.y - r)}, {-1.0f, -1.0f}, fillColor, outlineColor};   Vertex b = {{(GLfloat)(pos.x - r), (GLfloat)(pos.y + r)}, {-1.0f,  1.0f}, fillColor, outlineColor};   Vertex c = {{(GLfloat)(pos.x + r), (GLfloat)(pos.y + r)}, { 1.0f,  1.0f}, fillColor, outlineColor};   Vertex d = {{(GLfloat)(pos.x + r), (GLfloat)(pos.y - r)}, { 1.0f, -1.0f}, fillColor, outlineColor};      Triangle t0 = {a, b, c}; triangles[0] = t0;   Triangle t1 = {a, c, d}; triangles[1] = t1;      ChipmunkDebugDrawSegment(pos, cpvadd(pos, cpvmult(cpvforangle(angle), radius - ChipmunkDebugDrawPointLineScale*0.5f)), outlineColor);}`

thx
abakobo

Posts: 2
Joined: Thu Oct 20, 2016 5:12 am

### Re: debugDrawCircle understanding...

The shader I use takes the texture coordinates and draws an anti-aliased circle. The midsection of that circle is stretched to draw segments, and it's stretched into a bunch of different pieces to draw polygons.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/

slembcke