game: clean: give explicite name to variables
This commit is contained in:
parent
99f097cfaf
commit
ea50b9d072
@ -70,18 +70,18 @@ def get_interception(segment1: Segment, segment2: Segment):
|
|||||||
|
|
||||||
# because of in matematics world y = 10 is above y = 5 and on a display it is inverted I invert the coordonate
|
# because of in matematics world y = 10 is above y = 5 and on a display it is inverted I invert the coordonate
|
||||||
|
|
||||||
tmp1 = Segment(Point(segment1.start.x, config.MAP_SIZE_Y - segment1.start.y), Point(segment1.stop.x, config.MAP_SIZE_Y - segment1.stop.y))
|
inverted_segment1 = Segment(Point(segment1.start.x, config.MAP_SIZE_Y - segment1.start.y), Point(segment1.stop.x, config.MAP_SIZE_Y - segment1.stop.y))
|
||||||
tmp2 = Segment(Point(segment2.start.x, config.MAP_SIZE_Y - segment2.start.y), Point(segment2.stop.x, config.MAP_SIZE_Y - segment2.stop.y))
|
inverted_segment2 = Segment(Point(segment2.start.x, config.MAP_SIZE_Y - segment2.start.y), Point(segment2.stop.x, config.MAP_SIZE_Y - segment2.stop.y))
|
||||||
|
|
||||||
if (identify(segment1) == NORMAL and identify(segment2) == NORMAL):
|
if (identify(segment1) == NORMAL and identify(segment2) == NORMAL):
|
||||||
|
|
||||||
# representation m * x + p
|
# representation m * x + p
|
||||||
|
|
||||||
m1 = get_derive(tmp1)
|
m1 = get_derive(inverted_segment1)
|
||||||
m2 = get_derive(tmp2)
|
m2 = get_derive(inverted_segment2)
|
||||||
|
|
||||||
p1 = get_intercept(m1, tmp1.start)
|
p1 = get_intercept(m1, inverted_segment1.start)
|
||||||
p2 = get_intercept(m2, tmp2.start)
|
p2 = get_intercept(m2, inverted_segment2.start)
|
||||||
|
|
||||||
# m1 * x + p1 = m2 * x + p2
|
# m1 * x + p1 = m2 * x + p2
|
||||||
# m1 * x = m2 * x + p2 -p1
|
# m1 * x = m2 * x + p2 -p1
|
||||||
@ -98,14 +98,14 @@ def get_interception(segment1: Segment, segment2: Segment):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if (identify(tmp1) == VERTICALLY):
|
if (identify(inverted_segment1) == VERTICALLY):
|
||||||
constant: float = get_constant(tmp1)
|
constant: float = get_constant(inverted_segment1)
|
||||||
m: float = get_derive(tmp2)
|
m: float = get_derive(inverted_segment2)
|
||||||
p: float = get_intercept(m, tmp2.start)
|
p: float = get_intercept(m, inverted_segment2.start)
|
||||||
else:
|
else:
|
||||||
constant: float = get_constant(tmp2)
|
constant: float = get_constant(inverted_segment2)
|
||||||
m: float = get_derive(tmp1)
|
m: float = get_derive(inverted_segment1)
|
||||||
p: float = get_intercept(m, tmp1.start)
|
p: float = get_intercept(m, inverted_segment1.start)
|
||||||
|
|
||||||
x: float = constant
|
x: float = constant
|
||||||
y: float = config.MAP_SIZE_Y - (m * x + p)
|
y: float = config.MAP_SIZE_Y - (m * x + p)
|
||||||
|
Loading…
Reference in New Issue
Block a user