Curve to Polygon

Started by
5 comments, last by gfxCahd 10 years, 2 months ago

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.

Advertisement

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.

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.

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

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.

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.

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!

This topic is closed to new replies.

Advertisement