Reduce line widths in AABB and projection demos
This commit is contained in:
parent
e6ff706419
commit
0293c17b3b
@ -45,10 +45,10 @@ class AABBDistance:
|
|||||||
distance = length(gap_x, gap_y)
|
distance = length(gap_x, gap_y)
|
||||||
|
|
||||||
text_screen(surface, WHITE, (10, HEIGHT - 20), f"Distance: {distance}")
|
text_screen(surface, WHITE, (10, HEIGHT - 20), f"Distance: {distance}")
|
||||||
rect_a.draw(surface, YELLOW, 4)
|
rect_a.draw(surface, YELLOW, 1)
|
||||||
rect_b.draw(surface, WHITE, 4)
|
rect_b.draw(surface, WHITE, 1)
|
||||||
line(surface, RED if distance < 0 else GREEN,
|
line(surface, RED if distance < 0 else GREEN,
|
||||||
rect_a.get_center(), rect_b.get_center(), 2)
|
rect_a.get_center(), rect_b.get_center())
|
||||||
|
|
||||||
class PointAABBDistance:
|
class PointAABBDistance:
|
||||||
|
|
||||||
@ -86,6 +86,6 @@ class PointAABBDistance:
|
|||||||
distance = length(gap_x, gap_y)
|
distance = length(gap_x, gap_y)
|
||||||
|
|
||||||
text_screen(surface, WHITE, (10, HEIGHT - 20), f"Distance: {distance}")
|
text_screen(surface, WHITE, (10, HEIGHT - 20), f"Distance: {distance}")
|
||||||
rect_a.draw(surface, YELLOW, 4)
|
rect_a.draw(surface, YELLOW, 1)
|
||||||
line(surface, RED if distance < 0 else GREEN,
|
line(surface, RED if distance < 0 else GREEN,
|
||||||
rect_a.get_center(), (cx, cy), 2)
|
rect_a.get_center(), (cx, cy))
|
||||||
|
@ -26,7 +26,7 @@ class VecProj:
|
|||||||
proj = dot(lcx, lcy, lx, ly) / llen
|
proj = dot(lcx, lcy, lx, ly) / llen
|
||||||
nearest_point = add(x1, y1, *scale(lnx, lny, proj))
|
nearest_point = add(x1, y1, *scale(lnx, lny, proj))
|
||||||
|
|
||||||
line(surface, GREEN, (cx, cy), nearest_point, 5)
|
line(surface, GREEN, (cx, cy), nearest_point, 2)
|
||||||
line(surface, WHITE, (cx, cy), (x1, y1), 5)
|
line(surface, WHITE, (cx, cy), (x1, y1), 2)
|
||||||
line(surface, YELLOW, (x1, y1), (x2, y2), 5)
|
line(surface, YELLOW, (x1, y1), (x2, y2), 2)
|
||||||
line(surface, RED, (x1, y1), nearest_point, 5)
|
line(surface, RED, (x1, y1), nearest_point, 4)
|
||||||
|
Loading…
Reference in New Issue
Block a user