Dev:Spline Bline

From Synfig Studio :: Documentation
Revision as of 19:08, 22 January 2016 by D.j.a.y (Talk | contribs) (Other informations: {{l|Dev:Linking_to_Blines_-_Equations}})

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tangent

Regarding to tangents orientation

Say you have a spline made with two points P1 and P2 and two tangents T1 and T2. If you draw the spline and its tangents on screen by your own (by hand), you'll notice that T2 is drawn like that:

Spline.jpg

See how the Spline tool draws each tangent extending the tangent towards the direction of drawing. But for convenience we draw on screen -T2 because usually tangents on a point are coincident on consecutive splines so if we draw T2 as it is, it would overlap with T1 from the next spline and so we would have problems handling it.

Regarding to angles

Angles are tricky. And specially in Synfig Studio ;-) When you manipulate a handle in Synfig the sequence is this: The original value of the handle is cached and only when the user release the mouse (drop the handle again on screen) the new value is stored on the handle. For linear or radial values there is not problem with that, you just replace the old value with the new value and that's all. But with that simple behavior applied on angles (any angle handle) we would loose the ability of pass 180º value (or just in case 360º). In some handles and parameters from some layers, this is important, because the angle value could be used anywhere and its value beyond 360 can be important (due to Convert types and connection with math formulas). So we decided to include on the code detect the movement of the angles between the four quadrants. If you pass from one quadrant to its consecutive, the trim of the 180 degrees produced by maths (when you calculate the arctang of its x,y position) is not applied and the value is increased consequently. Say we are on 178 degrees angle and move to 185. With the old algorithm it would result to be -175 and with the new algorithm it is 185. Said that, angles are coherent with the history of the movements of the tangents by you, the user and different for each situation.

Regarding to the tangent size

Tangents are drawn by 1/3 of its real length. Is it like that because the real length is excessive long to be manageable. So you have to take account that reduction in order to manually give the values to the spline parameters to draw a particular spline calculated by maths. (Note to coders: this 1/3 value can be added to the meta data)

Spline point tangent handling

   Wrote by genete to prepare change to tangent split function. Implemented now. But still some info to dig into.

Target:

Handle the tangents in Synfig Studio like they are handled in Inkscape. It will affect to SplinePoints and the corresponding actions.

Changes to produce:

1) Current split tangent flag allows to independize completely one tangent from the other. It will be replaced by the union of two flags: tangent angle flag and tangent radius flag

2) By default newly created Splines do have tangent radius flag enabled (radius is not linked)

3) By the change of 1), the current component of the SplinePoint, “split” will be deprecated. In fact it will be alive in the SplinePoint to keep backward compatibility but it will be hidden to user edition.

4) The new behavior of the tangents will be this:

Let’s call:

  • split angle flag = saf
  • split radius flag= srf
  • tangent 1 angle = a1
  • tangent 2 angle = a2
  • tangent 1 radius = r1
  • tangent 1 radius = r2
sra srf angles radius
false false a1=a2 r1=r2
true false a1!=a2 r1=r2
false true a1=a2 r1!=r2
true true a1!=a2 r1!=r2

5) There will be new Actions to split/merge angle, split radius and split both (this last one will be the original one reworked)

6) New ways to split angle and radius with the mouse gestures will be created. I will keep the click and drag with shift pressed to split angle and will add click and drag with ALT or CTRL pressed to split radius. Maybe there could be new mouse gestures to merge radius, angle or both but I’m not sure about this yet.

7) Old files will load the split tangent normally and it will be stored in the hidden “split” sub-parameter. The Value Node that “split” holds from the old file, will be stored as well in the “split_angle” and “split_radius” since the logic is that split=split_angle && split_radius

BONUS:

In the future when a new SplinePoint is inserted, the calculated tangents can be adapted to keep the shape of the original Bezier better than it does now, thanks to there is the option of split the radius in the insertion point.


Other informations