Sign in to follow this  
gfxCahd

Curve to Polygon

Recommended Posts

gfxCahd    234

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 this post


Link to post
Share on other sites
Ashaman73    13715

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 this post


Link to post
Share on other sites
gfxCahd    234

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 this post


Link to post
Share on other sites
gfxCahd    234

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 this post


Link to post
Share on other sites
eppo    4877

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 this post


Link to post
Share on other sites
gfxCahd    234

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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this