[optimization] skip bezier
skip bezier if all handles sit on their points
This commit is contained in:
parent
8965ab11eb
commit
3ef2ae934d
1 changed files with 4 additions and 0 deletions
|
@ -94,6 +94,8 @@ def calc_point_on_bezier(bezier_point_1, bezier_point_2, t):
|
|||
h1 = bezier_point_1.handle_right
|
||||
p2 = bezier_point_2.co
|
||||
h2 = bezier_point_2.handle_left
|
||||
if p1 == h1 and p2 == h2:
|
||||
return p1 + t * (p2 - p1)
|
||||
return (
|
||||
((1 - t) ** 3) * p1
|
||||
+ (3 * t * (1 - t) ** 2) * h1
|
||||
|
@ -126,6 +128,8 @@ def calc_tangent_on_bezier(bezier_point_1, bezier_point_2, t):
|
|||
h1 = bezier_point_1.handle_right
|
||||
p2 = bezier_point_2.co
|
||||
h2 = bezier_point_2.handle_left
|
||||
if p1 == h1 and p2 == h2:
|
||||
return (p2 - p1).normalized()
|
||||
return (
|
||||
(-3 * (1 - t) ** 2) * p1
|
||||
+ (-6 * t * (1 - t) + 3 * (1 - t) ** 2) * h1
|
||||
|
|
Loading…
Add table
Reference in a new issue