[mtl canvas] make diagonal checks inclusive in mtl_side_of_segment()
This commit is contained in:
parent
53946a5710
commit
e999af6bd3
|
@ -132,10 +132,10 @@ int main()
|
|||
|
||||
mg_set_cap(MG_CAP_NONE);
|
||||
|
||||
mg_move_to(200, 200);
|
||||
mg_line_to(300, 300);
|
||||
mg_line_to(200, 400);
|
||||
mg_line_to(100, 300);
|
||||
mg_move_to(x+200, y+200);
|
||||
mg_line_to(x+300, y+300);
|
||||
mg_line_to(x+200, y+400);
|
||||
mg_line_to(x+100, y+300);
|
||||
mg_close_path();
|
||||
mg_set_color_rgba(1, 0, 0, 1);
|
||||
// mg_set_width(2);
|
||||
|
|
|
@ -229,8 +229,8 @@ int mtl_side_of_segment(float2 p, const device mg_mtl_segment* seg, mtl_log_cont
|
|||
float dx = p.x - seg->box.x;
|
||||
float dy = p.y - seg->box.y;
|
||||
|
||||
if( (seg->config == MG_MTL_BR && dy > alpha*dx)
|
||||
||(seg->config == MG_MTL_TR && dy < ofs - alpha*dx))
|
||||
if( (seg->config == MG_MTL_BR && dy >= alpha*dx)
|
||||
||(seg->config == MG_MTL_TR && dy <= ofs - alpha*dx))
|
||||
{
|
||||
side = -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue