DuckQueen
DuckQueen

Reputation: 800

How to get a mesh from curves describing it?

I have curves that describe a stone (say 2 to 10 curves). They are given as simple 3d {normal in (x,y,z); point (x,y,z); normal out(x,y,z)} curve points, that are stored in vectors (9 floats per point, at least 2 points per curve). They are all closed so that Curves[i][0] == Curves[i][last] and all curves are centered around a single known point in space S. How to turn such curves into a poligon mesh?

Upvotes: 0

Views: 120

Answers (1)

kolenda
kolenda

Reputation: 2811

First you'll need some way to interpolate single value in 1D. Let's say you have some 't' parameter ranging from 0 to 1. Along this range you have some data points, they may be in regular intervals or not. The question is: for your given data points and any 't' value compute your function for this 't'.

When you have this working you may go futher. From your description I assume that you have few shapes that go around the object. It seems like longitude lines of Earth. If that's correct then all of them should join in two points. You can look for points from every shape that are close to each other - that would be the 'start' of your shapes.

When you have the starting points of each shape you can get second or third point and compute its angle from center, looking from top. This way you can find the order in which your shapes go around the object.

If all of your shapes have the same number of points and if they are distributed evenly then building a mesh is basically adding quads with corners like:

shape[i].point[j]
shape[i].point[j+1]
shape[i+1].point[j]
shape[i+1].point[j+1]

If your shapes are more complicated, or if they can cross each other or if they can have different amount of points then this logic would complicate but we don't have any more info on this.

Upvotes: 1

Related Questions