c# - How can I connect two parallel 2d polygons to create a seamless 3d mesh? -


Suppose I have two polygons, which is above the other like this:

< Img src = "https://i.stack.imgur.com/otro0.png" alt = "two polygons">

I make my perimeter around a 3D triangle around the circumference I want to connect. This picture shows you in a way that you can do this (orange lines show triangle edges):

Such things can be easily done by humans, but I am having difficulty translating it into an algorithm.

Polygon as a list & lt; Vector 2 & gt; They will always be easy, and they can be intervals.

I will do this like this:

  • For example CW such as curved rule ) Redirect the top order

    for it

  • It does not have to be exact In but will cause incorrectly errors in production mesh position of the selected center complex concave shapes.

  • Add angular information for each header

    The angle is easy to use

      

     polygon

    angle for [degree]

      index: 0 1 2 3 4 green: 355 085 135 170 230 blue: 020 135 255  

    Now you just match 2 to the nearest vertebra from a polygon to another

    Do not forget that angle The difference is max +/- 180 degrees and if If you use radians, then change the constant 180,360 to PI, 2.0 * PI

      da = ang1-ang0; While (da & quot; -180.0) da + = 360.0; While (Da> +180.0) da- = 360.0; If (da & lt; 0.0) da = -da;  

    The line for the next lesson (i, j) stands for i-th green and j-th << / P>

    All green vertebrae and the nearest blue peak ( Black line on image)

      line (0,0) line (1,1) line (2,1) line (3,1) line (4,2)  < Fill the hole  
  • / P>

      Index: 0 1 2 3 4 Green connection: 1 1 1 1 1 blue connection: 1 3 1  

    so now the process uses 2 times blue layers (0,2) and the connections used in advance (in that case the next one Selected) is included in the nearest green show (yellow rows on the image) by ignoring the

      line (1,0) row (3,2)   

    Such:

      Index: 0 1 2 3 4 Green connection: 1 2 1 2 1 blue connection: 2 3 2  

    Now the green color process is less, 2 times In the vertebrae using at least used 3 times blue top. Next point is selected for the connection already used, if there are at least 3 connections and if there is more then use the option 1 to find the nearest (red line on the image).


    <0> line (0,2)
    green 0 is associated with blue 0, then select from blue 1,2 (1 too) Very much used 2)
    line (2, -) green 2 is connected to blue 1 which is used 3 times, so ignore this head. line (4, -) green 4 is connected to blue 2 which is used 3 times so that this top of the list is ignored

      index: 0 1 2 3 4 green Connection of color: 2 2 1 2 1 blue connection: 2 3 3  

    And it is everything. Now you should be done like this:

    mesh

    [notes]

    • You can also use the length of the perimeter instead of the perimeter / angle (sometimes it has a better result)
    • To overcome the concave polygonal problem, some triangle intersections should be added to the probe.
    • That number should not be too different between polynomials, in that case you can still split some rows to add missing points, otherwise it will be wrong to use 3 times (if The top number is 2 or more times different)
    • If you want to be safe then you should separate the polygon to concretize the parts and separate them separately and separate them The only one should be included
    get back together.

    Comments

    Popular posts from this blog

    sqlite3 - UPDATE a table from the SELECT of another one -

    c# - Showing a SelectedItem's Property -

    javascript - Render HTML after each iteration in loop -