shithub: fnt

Download patch

ref: ca4cce3e681feb3e411f52674f43cd59e7df7737
parent: def6bc8aa2a70c6dd9f7974ca12992efd32b2ebd
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Jul 14 13:15:16 EDT 2024

raster: lines: the range is [0,1) not [0,1]

--- a/rast.c
+++ b/rast.c
@@ -228,8 +228,8 @@
 		if(α₂ < 0) return 0;
 		α₁ = 0;
 		β₁ = (y₂-y₁)/(x₂-x₁)*(0-x₁)+y₁;
-	}else if(α₁ > 1){
-		if(α₂ > 1) return 0;
+	}else if(α₁ >= 1){
+		if(α₂ >= 1) return 0;
 		α₁ = 1;
 		β₁ = (y₂-y₁)/(x₂-x₁)*(1-x₁)+y₁;
 	}
@@ -236,7 +236,7 @@
 	if(α₂ < 0){
 		α₂ = 0;
 		β₂ = (y₂-y₁)/(x₂-x₁)*(0-x₁)+y₁;
-	}else if(α₂ > 1){
+	}else if(α₂ >= 1){
 		α₂ = 1;
 		β₂ = (y₂-y₁)/(x₂-x₁)*(1-x₁)+y₁;
 	}
@@ -244,8 +244,8 @@
 		if(β₂ < 0) return 0;
 		β₁ = 0;
 		α₁ = (x₂-x₁)/(y₂-y₁)*(0-y₁)+x₁;
-	}else if(β₁ > 1){
-		if(β₂ > 1) return 0;
+	}else if(β₁ >= 1){
+		if(β₂ >= 1) return 0;
 		β₁ = 1;
 		α₁ = (x₂-x₁)/(y₂-y₁)*(1-y₁)+x₁;
 	}
@@ -252,7 +252,7 @@
 	if(β₂ < 0){
 		β₂ = 0;
 		α₂ = (x₂-x₁)/(y₂-y₁)*(0-y₁)+x₁;
-	}else if(β₂ > 1){
+	}else if(β₂ >= 1){
 		β₂ = 1;
 		α₂ = (x₂-x₁)/(y₂-y₁)*(1-y₁)+x₁;
 	}