Skip to content

Commit

Permalink
When creating a new entry in a BLine, make the tangents the adequate …
Browse files Browse the repository at this point in the history
…to fit the shape. It needs two extra actions to update adjacent BLinepoint tangents.
  • Loading branch information
genete committed Sep 14, 2013
1 parent 06692da commit 4dcb4eb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions synfig-core/src/synfig/valuenode_bline.cpp
Expand Up @@ -606,12 +606,15 @@ ValueNode_BLine::create_list_entry(int index, Time time, Real origin)
next=(*list[next_i].value_node)(time);
prev=(*list[prev_i].value_node)(time);
etl::hermite<Vector> curve(prev.get_vertex(),next.get_vertex(),prev.get_tangent2(),next.get_tangent1());
etl::derivative< etl::hermite<Vector> > deriv(curve);
bline_point.set_vertex(curve(origin));
etl::hermite<Vector> left;
etl::hermite<Vector> right;
curve.subdivide(&left, &right, origin);
bline_point.set_vertex(left[3]);
bline_point.set_width((next.get_width()-prev.get_width())*origin+prev.get_width());
bline_point.set_tangent1(deriv(origin)*min(1.0-origin,origin));
bline_point.set_tangent2(bline_point.get_tangent1());
bline_point.set_split_tangent_both(false);
bline_point.set_split_tangent_radius(true);
bline_point.set_split_tangent_angle(false);
bline_point.set_tangent1((left[2]-left[3])*-3);
bline_point.set_tangent2((right[1]-right[0])*3);
bline_point.set_origin(origin);
}
ret.index=index;
Expand Down

0 comments on commit 4dcb4eb

Please sign in to comment.