calculate overlap of two parallel lines
php
Solution
Just a quick thought, but I think it works.
Take the highest start value from the lines as `start'` Take the lowest end value from the lines as `end'`
if `start' < end'` you have an overlap of (`end' - start'`)
Problem
I have 2 parallel lines in an 2D space. The lines are defined with $min1, $max1, $min2, $max2 I already figured out how to check if they overlap: ``` function overlap($min1,$max1,$min2,$max2){ if(($min1<$min2 && $max1>$min2) || ($min1<$max2 && $max1>$max2) || ($min1==$min2 && $max1==$max2) || ($min2>=$min1 && $max2<=$max1) || ($min1>=$min2 && $max1<=$max2)){ return true; } return false; } ``` Now i have to check the overlaping length, but i have no idea how to implemnt this. i need this to get the minmal translation vector in a separating axis theorem implementation any hint would be great.