Generating a rounded 2D profile of points

Hi,

Does anyone know the algorithm for producing a string of N vertices for these 2D profiles, based on the parameter value between 0 and 1.0 as shown? Or alternatively, a function to change the positions of an existing series of vertices similarly?

I just need the vertices - no lines on polygons.

What about this one (simplest thing):
Two pairs of three points in the lefthand image describe the two corners (counting from 0 at point 1 and 3) and the value 0.0 to 1.0 is the normalized radius of the circle at each corner point in lengths of the respective adjacent lines. (Confused?)
That’s able to do this rounded rectangle thing in the middle.

Could also be quadratic splines, but then the middle picture would be more difficult and needed weights.

Sorry Relic, I don’t follow you :confused:

This should be possible without the use of control points or splines.

Alternatively, I need generate only the top quadrant and mirror it to create the bottom.

Have you looked at subdivision surfaces (Loop subdivision, for example)? You can fix the mid vertex in place, for instance, so that only the corners are “smoothed”. This is usually presented in the context of generic 3D meshes, but it will work in 2D too (greatly simplified). This maybe a bit much for your needs, but it’s definitely worth looking at.

I think maybe that is more or less what Relic was getting at.

Cheers,

:slight_smile:

Thanks, but again I’m sure there is a simpler way :wink:

Actually, after reading Relic’s post again, his approach is very simple indeed. Just look at geometry of the situation: you have 2, 1/4 circles, each centered 1 radius distant from their respective tangent edges. Using this simple relationship, you could adjust your vertex positions to satisfy the radius constraint for each point on a 1/4 circle.

Nice, and simple too.

But don’t let the papers scare you, the 2D counterparts of subdivision surfaces are trivial to implement.

Cheers,

:slight_smile:

Yes, that’s what I meant. :slight_smile:

Can you post some pseudo code? :stuck_out_tongue: