Jump to content
  • Advertisement
Sign in to follow this  
gfxCahd

Curve to Polygon

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

If you intended to correct an error in the post then please contact us.

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


Link to post
Share on other sites
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.

Edited by Ashaman73

Share this post


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


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


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


Link to post
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!