# Curve to Polygon

This topic is 1774 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

This seems like a fundamental technicque, but goole hasn't come up with anything usefull.

I have some points in 3d space. How would I create the geometry to connect these points and display a 3d curve?

The points are distributed along a desired curve, and if I just use a polygon to connect the consecutive points, there will be gaps and other wierdness between the polygon ends, so I was wondering if there is a standard way of hidding these as best as possible.

Edited by gfxCahd

##### Share on other sites

If you just want to connect the points as curve (not surface), then take a look at splines, especially cubic splines. Bezier curves and surfaces are an option too. If you have just a generic point cloud, try to look for surface reconstruction.

Edited by Ashaman73

##### Share on other sites

Take a look at splines, especially cubic splines.

No, I already have the 3d curve; as a set of points.

I want to create a 3d "mesh" to "display" the curve.

Edited by gfxCahd

##### Share on other sites

Then just connect each point-pair with a line or degenerated tri (vertex1=vertex2).

##### Share on other sites

Then just connect each point-pair with a line or degenerated tri (vertex1=vertex2).

Eh, I'd like it to have some width though, like a ribbon.

##### Share on other sites

Use the tangent of the curve at every keypoint transformed into screen space to determine in which direction you should offset vertices to create thick lines.

e.g. using the 2D "cross product": float2 posOffsets[] = { pos + float2(tan.y, -tan.x) * thickness, pos - float2(tan.y, -tan.x) * thickness };

If the end- and begin-points of two consecutive segments share the same calculations the quads should connect without gaps.

Edited by eppo

##### Share on other sites

Use the tangent of the curve at every keypoint transformed into screen space to determine in which direction you should offset vertices to create thick lines.

e.g. using the 2D "cross product": float2 posOffsets[] = { pos + float2(tan.y, -tan.x) * thickness, pos - float2(tan.y, -tan.x) * thickness };

If the end- and begin-points of two consecutive segments share the same calculations the quads should connect without gaps.

Ok, I'd just have to make sure I have enough points in order to avoid any sharp bends. Then the distortions would be minimal. Seems pretty obvious now that I think of it.

Thanks!

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 9
• ### Forum Statistics

• Total Topics
634086
• Total Posts
3015413
×