[ad_1]
Game Development Stack Exchange is a query and reply website for skilled and impartial recreation builders. It solely takes a minute to enroll.
Anybody can ask a query
Anybody can reply
The greatest solutions are voted up and rise to the highest
Asked
Viewed
908 instances
I’ve a grid when it comes to two arrays:
factors
: incorporates 3D coordinates of factors.
triangles
: incorporates 3 indices per line for every triangle of the grid.
I want to interpolate the grid to make it smoother, i.e. add further factors and triangles in such a manner that the grid is smoother than it’s in the meanwhile. But I discovered that scipy.interpolate
solely works if the xy-points are common, which isn’t the case right here. Any recommendations?
$endgroup$
Measure every triangles sq. or non-smoothness, and if it’s not sufficiently small – then add a brand new vertex in its middle (Centroid) and reaplace the triangle with 3 smaller trangles utilizing that new vertex.
Update: Typically new Z worth is a median between different Z values, identical to with X and Y axis. If you will have an underlying top map – take values from it. Afterwards you could possibly apply a smoothing move – measure curvature between polys in every vertex and shift it accordingly to lower it.
$endgroup$
1
-
Create one other array parallel to your factors array to retailer regular vectors. Initialize it to zero vectors.
-
For every triangle in your mesh, compute a triangle regular because the cross product of two of its edges. Don’t normalize it — its size is proportional to the triangle space, which helps with uniformity in locations the place you will have uneven triangle density.
-
Add this triangle regular to the traditional array entries for every of the collaborating vertices.
-
Once you’ve got summed up all the normals, normalize each regular within the array (averaging the consequences the place a number of triangles share a vertex).
-
For every triangle, decompose it into extra triangles utilizing this native curvature information as a information. There are a number of totally different strategies you could possibly use right here, as an illustration…
-
For every fringe of the triangle, from every vertex in that edge, calculate a vector in that vertex’s native tangent airplane (perpendicular to the vertex regular) that factors towards the other finish of the sting.
-
With these two endpoints and tangent vectors, compute an interpolated level midway between, utilizing your favorite spline formulation.
-
Connect the three new edge-bisecting factors fashioned this approach to break up the unique triangle into 4, in a triforce sample.
-
$endgroup$
You should log in to reply this query.
Not the reply you are on the lookout for? Browse different questions tagged .
default
[ad_2]