Skip to content

Commit

Permalink
Use literal_pow rather than pow in Bezier
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Dec 3, 2019
1 parent c966641 commit eb734ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ end

#Double quadratic Bezier curve
function Bezier(t::T, p0::T, p2::T, q0::T, q1::T, q2::T) where T<:Real
B(t,a,b,c)=a*(1.0-t)^2.0+2.0b*(1.0-t)*t+c*t^2.0
B(t,a,b,c)=a*(1.0-t)^2 + 2.0b*(1.0-t)*t + c*t^2
if t <= 0.5
return B(2.0t, p0, q0, q1)
else #t > 0.5
Expand All @@ -79,7 +79,7 @@ end

#Inverse double quadratic Bezier curve
function invBezier(t::T, p0::T, p2::T, q0::T, q1::T, q2::T) where T<:Real
invB(t,a,b,c)=(a-b+sqrt(b^2.0-a*c+(a-2.0b+c)*t))/(a-2.0b+c)
invB(t,a,b,c)=(a-b+sqrt(b^2-a*c+(a-2.0b+c)*t))/(a-2.0b+c)
if t < q1
return 0.5*invB(t,p0,q0,q1)
else #t >= q1
Expand Down

0 comments on commit eb734ea

Please sign in to comment.