Difference between revisions of "Sewing Splines"
m |
m |
||
Line 11: | Line 11: | ||
[[Image:SewBlines1.png]] | [[Image:SewBlines1.png]] | ||
− | Select the vertex ducks and | + | Select the vertex ducks and right click and select the context menu "Link" |
[[Image:Link1.png]] | [[Image:Link1.png]] | ||
Line 17: | Line 17: | ||
[[Image:Link2.png]] | [[Image:Link2.png]] | ||
− | Then repeat the same procedure with the tangents (only one | + | Then repeat the same procedure with the tangents (only one of the pairs of tangents needs linking unless the tangents are split) |
[[Image:Link3.png]] | [[Image:Link3.png]] | ||
− | Now watch this situation. The Regions are constructed with the same clockwise direction. | + | Now watch this situation. The Regions are constructed with the same clockwise direction. The result is that the shared edge become incompatible for linking properly. The tangents are opposite each other (its green or red ducks are not at the same side of the vertex duck). |
[[Image:SewBlines2.png]] | [[Image:SewBlines2.png]] | ||
− | Repeat the same steps | + | Repeat the same steps as before. First link the vertex ducks and then link the tangent ducks. No matter what tangent ducks you link together (same color or different color), it always gives the same result: |
[[Image:Link4.png]] | [[Image:Link4.png]] |
Revision as of 00:11, 23 November 2007
This is a small tutorial that describes how to join any layers based on the BLine object by their edges. Such layers include the Region Layers, Outline Layers, Plant Layer and Curve Gradient Layer).
Contents
Problem Definition
It is not always possible to link the edges of the BLines, because they may have been constructed in opposite directions (clockwise and counter clockwise), causing the tangents not to be appropriate for linking to each other.
If you're lucky you can link the tangents and the Regions will display properly. In the following example the direction of region construction is shown by the red arrow. You can see the the green tangent ducks are on the same side of the vertex (the orange ducks). Similarly with the red ducks. It is not so obvious when the tangents are not parallel.
Select the vertex ducks and right click and select the context menu "Link"
Then repeat the same procedure with the tangents (only one of the pairs of tangents needs linking unless the tangents are split)
Now watch this situation. The Regions are constructed with the same clockwise direction. The result is that the shared edge become incompatible for linking properly. The tangents are opposite each other (its green or red ducks are not at the same side of the vertex duck).
Repeat the same steps as before. First link the vertex ducks and then link the tangent ducks. No matter what tangent ducks you link together (same color or different color), it always gives the same result:
Solution
To solve this problem there is a smart solution. As well as the tangents are just opposite one from the other the solution comes from converting the tangent to a scaled one. The scale should be exactly -1. This allow link opposite tangents together due you are going to link one of the tangents together but one of them is going to be displayed reversed.
(Recently has been commited a new convert type Reverse Tangent which allow simplify the task.)
For example let's make the right Region the one that we are going to modify its tangent. Here are the steps you should perform before you do the link of tangents. You can do it later but should repeat the linking operations.
- Select the vertex from the vertices list at Parameter Dialog. It will be marked with a red bracket around.
- Open the Vertex definition and search for the tangent you want to modify. If they are merged you can do it with any of them.
- Right click and select Convert->Scale
- Open the converted tangent and see that there are two new parameters: Link and Scale.
- Make right click over the Link parameter and Export it giving a proper name (for example t4 if it is the vertex number 4)
- Go to the Child list and Select the Value node you just have exported.
- Now go to the other layer and search the tangent you want to link to.
- Select it and make right click and select the Connect option.
- Now you have obtained the same result than previously :(. The Regions are looped at that point. Here comes the trick.
- Go to the converted and exported tangent and search the Scale parameter you have obtained from the Scale conversion. Make it equal to -1. Volia! the tangents match each other!
Alternatively to this steps, instead of covnerting to Scale and export the Link you could convert to Reverse Tangent and link it directly. I have not tested yet.
Notice that the other vertex ducks (of the other vertices) show how they have opposite colors.
Drawbacks
The converted tangent loose the ability of being manipulated by tangents ducks as usual. It is due to the fact that the tangent is not a Radial Composited which is the type of conversion that Synfig knows how manage internally with ducks interface.
You should modify the tangent of the vertex of that Region using the ducks of the other Region layer or by the numerical input of the x,y values.
Sewing more than two Blines
Sewing more than two Blines is mainly the same problem than described because locally you are going to stitch only two tangents each time. If you need to sew more than one vertex at the same place just repeat the steps making the proper change of tangent sign for the appropriated.
Sewing corners
One not obvious situation happen when you have to sew two corners. In that case the tangents (almost one of them) must be split. It can happen two clearly different situations:
- The outside tangents are linked. Usually you link them to obtain an smooth surface. It is like a 180 DEG corner.
- The outside tangents aren't linked. Then you want to create a real corner with control of each tangent. This case is a particular case of the above.
So lets study the case where the outside tangents are going to be linked having opposite values (they are always 180 DEG separated).
That case can be reached by two regions with same clockwise construction or opposite. Let start with the simple one.
Creating a smooth corner for compatible Blines
When you want to link two vertices that are going to create a smooth corner (a 180 DEG one) you have to do the following (I assume that the vertices are already linked, if not you can do it now or later):
- As well as the regions are tangent compatible (see the first previous example) the tangent ducks have same color on same side of the vertex. First is to split the tangents of both vertices. Right click on vertex and "Split Tangents".
- Then you should directly link the two tangents ducks for the inner par of the corner. It is the tangent that points down in the following figure (the red ones)
- If you link the other two tangents (the green ones) you would obtain two identical tangents. That's not what we ant to achieve we want that both tangents have the opposite direction so they match smoothly.
- Repeat the steps of Convert->Scale, export Link parameter and Link the exported to the other tangent. It would allow obtain this figure.
There you can see that the one of the two ducks of the upper tangent is greyed. It means that it cannot be manipulated due it is the one what was converted to Scale. To manipulate that tangent you must use the left side duck.
The red ones ducks of the other tangent are overlapping and you can manage one of them at a time.
If you don't want to create an smooth corner just don't make the link of the green tangent ducks in this case. Set them free and make the corner you want.
Creating a smooth corner for not compatible Blines
If the BLines are not compatible (second example of above) you should make now only one conversion too. The inner tangent still not being compatible, so it need a conversion to scale, an export and a link to the other tangent like in the previous example. But the outer one is compatible now because they are already two inverted tangents and can be linked to create a 180 DEG corner.
So after you have split the tangents you should obtain something like this:
Then you should link the red ducks but they are opposite. Then convert one of them to scale, export the Link parameter, link it to the other (red) tangent duck and make the scale parameter to be -1. It will make both regions have same rendered tangent on the sharing edge.
Once done you simply need to join the two green ducks. As well they are opposite they are compatible for a 180 DEG corner. The result should be this:
Dead End Corner
(If someone have a better name for this kind of vertices please change it freely)
I call this to a a vertex completely rounded by BLines and not have any outside tangent. The inner vertex of a shared edge is the extreme example of the most eneral case of a Dead End Corner vertex. It has only two tangents.
Here is an example of a preparation of a Dead End Corner. The three Regions are going to be joined in the central vertex.
If you have a look to the tangent ducks you can see that they match in pairs except the two upper ones. If you have followed the tutorial you can easily imagine that the tangent ducks that match its colors can be linked directly and the one that has the mismatch should be converted to scale, exported the Link parameter, linked to the other tangent and set the Scale parameter to -1. Like this:
So making the direct linking of the lower tangent ducks and making a reversed link to the upper pair of tangent ducks the Dead End Corner is properly created. Please try it by your self. If not success please ask here in the Discuss area.
Here is the result: