summaryrefslogtreecommitdiffstatsci
path: root/src/vkvg_context_internal.c
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2019-11-22 11:43:18 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2019-11-22 11:43:18 +0100
commit8d3e4df8cf302fe668f332f3eb849ea4f64c6239 (patch)
tree61ad34a56b6c3856c6c64fb000ab2bd71111753f /src/vkvg_context_internal.c
parent20c1cbace2b9f92380531cd72d86b9dbbcdc7eda (diff)
add nan test in _build_vb_step to prevent stroke building for two consecutive points that are equalsnewvertex
Diffstat (limited to 'src/vkvg_context_internal.c')
-rw-r--r--src/vkvg_context_internal.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c
index 7721be8..d9578ad 100644
--- a/src/vkvg_context_internal.c
+++ b/src/vkvg_context_internal.c
@@ -773,8 +773,13 @@ void add_line(vkvg_context* ctx, vec2 p1, vec2 p2, vec4 col){
}
void _build_vb_step (vkvg_context* ctx, Vertex v, float hw, uint32_t iL, uint32_t i, uint32_t iR, bool isCurve){
+ //if two of the three points are equal, normal is null
vec2 v0n = vec2_line_norm(ctx->points[iL], ctx->points[i]);
+ if (vec2_isnan(v0n))
+ return;
vec2 v1n = vec2_line_norm(ctx->points[i], ctx->points[iR]);
+ if (vec2_isnan(v1n))
+ return;
vec2 bisec = vec2_norm(vec2_add(v0n,v1n));