diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2022-10-30 07:59:06 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2023-03-01 18:56:44 +0100 |
| commit | e5182423290ab875ce54187098157a64aa039f20 (patch) | |
| tree | 2251b8ce76010b2b0f826f75ca5592574bf38ccd | |
| parent | aabfb40464b83702bdfc0cfe5520d6519bd6dd17 (diff) | |
store result of cos()
| -rw-r--r-- | src/vkvg_context_internal.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c index 5342117..d6b529b 100644 --- a/src/vkvg_context_internal.c +++ b/src/vkvg_context_internal.c @@ -977,8 +977,8 @@ bool _build_vb_step(VkvgContext ctx, stroke_context_t* str, bool isCurve){ alpha = -alpha; float halfAlpha = alpha / 2.f; - - float lh = str->hw / cosf(halfAlpha); + float cosHalfAlpha = cosf(halfAlpha); + float lh = str->hw / cosHalfAlpha; vec2 bisec_n_perp = vec2_perp(bisec_n); //limit bisectrice length @@ -1000,7 +1000,7 @@ bool _build_vb_step(VkvgContext ctx, stroke_context_t* str, bool isCurve){ vnPerp = vec2_perp (v0n); vec2 vHwPerp = vec2_mult_s (vnPerp, str->hw); - double lbc = cosf(halfAlpha) * rlh; + double lbc = cosHalfAlpha * rlh; if (det < 0.f) { rlh_inside_pos = vec2_add (vec2_add (vec2_mult_s(vnPerp, -lbc), vec2_add(p0, bisec)), vHwPerp); rlh_outside_pos = vec2_sub (p0, vec2_mult_s (bisec_n_perp, lh)); @@ -1029,7 +1029,7 @@ bool _build_vb_step(VkvgContext ctx, stroke_context_t* str, bool isCurve){ if (join == VKVG_LINE_JOIN_MITER){ if (lh > str->lhMax) {//miter limit - double x = (lh - str->lhMax) * cosf (halfAlpha); + double x = (lh - str->lhMax) * cosHalfAlpha; vec2 bisecPerp = vec2_mult_s (bisec_n, x); bisec = vec2_mult_s (bisec_n_perp, str->lhMax); if (det < 0) { |