• Create Account

## Curve to Polygon

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

6 replies to this topic

### #1gfxCahd  Members

230
Like
0Likes
Like

Posted 11 March 2014 - 03:28 AM

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, 11 March 2014 - 03:32 AM.

### #2Ashaman73  Members

13649
Like
0Likes
Like

Posted 11 March 2014 - 06:06 AM

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, 11 March 2014 - 06:09 AM.

Ashaman

### #3gfxCahd  Members

230
Like
0Likes
Like

Posted 11 March 2014 - 06:08 AM

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, 11 March 2014 - 06:08 AM.

### #4Ashaman73  Members

13649
Like
0Likes
Like

Posted 11 March 2014 - 06:11 AM

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

Ashaman

### #5gfxCahd  Members

230
Like
0Likes
Like

Posted 11 March 2014 - 06:33 AM

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.

### #6eppo  Members

4596
Like
1Likes
Like

Posted 11 March 2014 - 07:49 AM

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, 11 March 2014 - 07:51 AM.

### #7gfxCahd  Members

230
Like
0Likes
Like

Posted 11 March 2014 - 08:22 AM

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!

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.