利用者:RedTriangle/Bridge

提供: wiki
< 利用者:RedTriangle
2018年6月29日 (金) 05:49時点におけるYamyam (トーク | 投稿記録)による版 (1版 をインポートしました)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Bridge

Introduction

AboutBridge.png

The Bridge action allows you to create a mesh connecting two pieces of geometry, in other words bridging them. The bridge function cannot be used on two separate objects, so it should be single object. The bridge operation can be used to join two or more edges or faces.

For Old Bridge to work we need to select an equal number of edges or faces on both sides. In New Bridge we can select not equal numbers of the edges in loops.

In desdoc I found some image which decribe how bridge must work. [1] [2]

Now in blender 'Bridge' is implemented this way: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.63/BMesh#Bridge


Limitations of old version of the Bridge tool:

  • For Old Bridge to work we need to select an equal number of edges or faces on both sides.
  • Old Bridge has no parameters so we can’t change some attributes about the bridge (segmentation or interpolation, for example).
  • Old Bridge has lots of problems with strongly shifted loops
  • Old Bridge doesn't work with several selected polygons
  • 'Bridge' works only with loops. We have an error("Selection must only contain edges from two edge loops") when we select few adjacent faces. Current 'Bridge' can not correctly calculate the loop.

Useful Features of LoopTools Bridge

  • We can select the type of bridge we want.
  • We can choose between Linear or Bicubial interpolation, determine the number of segments, etc.

But even LoopTools Bridge has some problems in correctly determination of connected edges. [img] [img] [img]

Goal of my work So main goal of my work on Bridge was improve the old bridge, adding advantages of LoopTools Bridge and eliminate the shortcomings.

LoopTools plugin(https://sites.google.com/site/bartiuscrouch/scripts/bridge) devoid of these shortcomings. So we need rewrite current code of 'Bridge' considering points of 'LoopTools' plugin.

How it works

Next I will describe the major decisions that I have used in the implementation of the bridge.

The generalized algorithm

1. The analysis of input data. There are two cases of input data: the same and different number of edges in the selected loops. In the first case, it is enough to find a pair for every edge. In the second case, for the faces, which don't have a couples it is necessary to find the nearest point on the opposite loop. Also, it is necessary to exclude the internal edges that should not be involved in the construction of the bridge.

2. Calculation of the geometry of the bridge. In LoopTools plugin and the older version of the bridge, nearest edges were determined and then connected. It does not work correctly in that case when input loops are strongly shifted from each other (this case is shown on an example below). To solve this problem, I propose to compare the input loops in the local coordinate system. Also, the older version of the bridge worked only in the case when input loops was equal.

3. Building of new quads or triangles. It's necessary to calculate intermediate points for each pair of edges (or edge and vertex), which should be connected, in accordance with the parameters of interpolation and segmentation Also we should checking for convexity of new faces.

Inputs analysis

Bridge inner faces.png

It’s necessary to isolate input data from a set of selected items. First we analyse selected faces. We define the them edges and save them in a separate list. Then we count how many times each edge is found in that list. If the edge is repeated more than 1 time, then it is related (or internal) edge and it should be excluded from next consideration. Then we take first edge from a list of selected items, and start looking for an edge that connect with them and add them to a separate list, taking into account the edges, which should be ignored. If we get more than two such lists then was selected a few loops, and the bridge could be built, we get a warning. The result is an array of two input edges.

Geometry calculating

Nearest point.png

The main idea consists on determination of those edges which could be joined. And then we determine optimal points for those edges which have no pair to connected, and join them with this points. That’s why we start our search from smallest input loop. The optimal edge is the edge which is nearest located to the joined edge. For example on the image below, the nearest point for the point v2 is v3, but it would be more correct to join v2 with v4. That’s why I suggest to determine distance between points in the local coordinate systems, taking as a starting point centers of the input loops.

Polygon creation

Cross product.png

Inputs for future created polygon are two edges or an edge and a point, parameters of segmentation and interpolation.In main case the main thing we should done is determine correct order of verticles enumeration in the new face. For this purpose we find the cross product for each pairs of edges, selected in same order. If resulted vectors directed to one side - it was right order of points, else - we should change the order of verticles enumeration. Parameter of segmentation determines the number of faces used to bridge the distance between two loops if it’s not equal zero. Two (or more) segments means that an intermediary line of vertices should be created, so two or more faces should be created between inputs loops. When we create a new intermediate point we need to check if this point been created already. If we don’t do it we get unlinked internal faces.

Examples

Input data LoopTools New Bridge
Bridge example 1.png

Selected two faces in on each side,

input edges count are equals

Bridge example 1 1.png Bridge example 1 2.png
Bridge example 2.png

Input edges count not equals

Bridge example 2 1.png Bridge example 2 2.png
Bridge example 3.png

Arbitrary shape of input edges

Bridge example 3 1.png Bridge example 3 2.png