Two sides are parallel if the sum of the angles between them is a multiple of 180 degrees
This is measured by starting from the ending point of the initial side to starting point of the terminal side
Consider a square. We can select a side and move clockwise to the next side after encountering an angle of 90 degrees. After moving clockwise again we would have an angular sum of 90 + 90 = 180 degrees and curiously another parallel side.
On a regular Hexagon we can pick a side and move clock-wise to the next side (accumulating an angle of 120 degrees in the process), move clock-wise again (now at 240 degrees) and again (now at 360 degrees = 2*180) sure enough this third side will be parallel to the initial side.
So the strategy for this problem is going to be bit more involved
Now imagine if this angles were strung together on a piece of string (in a shape just like the diagram you presented)
We want to compute each possible consecutive sequence of these angles. If any of these consecutive sums is a multiple of 180 degrees we will have found a pair of sides that is parallel.
Seeing that this is a lot of work (and I know no obviously quicker way of doing it) I decided to automate the result with a computer program: It is written in python (code at bottom of answer)
the side that ends at angle d and the side that ends at angle j are parallel.
The running sum between them is 720 degrees whichever way you choose to traverse the polygon.
Moving Counter Clockwise with side ending at D
$$140+145+145+140+150 = 720 = 4*180$$
Moving Clockwise with side (ending at D from CC direction)
$$148 + 144 + 135 + 148 + 145 = 720 = 4*180$$
The code below computed it:
def arraysum(startpoint, endpoint, array): #sums wrapping around array for up to one loop
if(endpoint < startpoint):
return "Invalid! End < Start"
if(endpoint ==startpoint):
return array[startpoint%len(array)]
else:
w = 0
endpoint = endpoint%len(array) #find the ending spot
if(endpoint > startpoint): #if the end is unchanged
i = startpoint
while(i <= endpoint):
w = w + array[i]
i = i + 1
return w
if(endpoint < startpoint): #if end has shifted around the loop
i = startpoint
while(i < len(array)):
w = w + array[i]
i = i + 1
i = 0
while(i <= endpoint):
w = w + array[i]
i = i + 1
return w
def findconsecsums(array): #finds consecutive sums and outputs if they are multiples of 180
i = 0
while(i < len(array)): #for each element
j = 0
while(j < len(array)): #for each spacing
if(arraysum(i, i + j, array)%180==0): #test consecutive sum if it is a multiple of 180
print "FOUND!"
print arraysum(i,i+j,array)
print i, array[i] #prints the starting angle
print i+j, array[(i+j)%len(array)] #prints the ending angle
print "\n"
j = j + 1
i = i + 1
inputarray = [148, 140, 145, 145, 140, 150, 145,148, 135, 144]
findconsecsums(inputarray)
Two sides are parallel if the sum of the angles between them is a multiple of 180 degrees
This is measured by starting from the ending point of the initial side to starting point of the terminal side
Consider a square. We can select a side and move clockwise to the next side after encountering an angle of 90 degrees. After moving clockwise again we would have an angular sum of 90 + 90 = 180 degrees and curiously another parallel side.
On a regular Hexagon we can pick a side and move clock-wise to the next side (accumulating an angle of 120 degrees in the process), move clock-wise again (now at 240 degrees) and again (now at 360 degrees = 2*180) sure enough this third side will be parallel to the initial side.
So the strategy for this problem is going to be bit more involved
We will produce the list of angles below
$$148, 140, 145, 145, 140, 150, 145,148, 135, 144 $$
Now imagine if this angles were strung together on a piece of string (in a shape just like the diagram you presented)
We want to compute each possible consecutive sequence of these angles. If any of these consecutive sums is a multiple of 180 degrees we will have found a pair of sides that is parallel.
Seeing that this is a lot of work (and I know no obviously quicker way of doing it) I decided to automate the result with a computer program: It is written in python (code at bottom of answer)
the side that ends at angle d and the side that ends at angle j are parallel.
The running sum between them is 720 degrees whichever way you choose to traverse the polygon.
Moving Counter Clockwise with side ending at D $$140+145+145+140+150 = 720 = 4*180$$
Moving Clockwise with side (ending at D from CC direction) $$148 + 144 + 135 + 148 + 145 = 720 = 4*180$$
The code below computed it: