ProcessPoints

# ProcessPoints - #Programmer Zhaoyang Dai#Section...

• 2

This preview shows pages 1–2. Sign up to view the full content.

#Programmer: Zhaoyang Dai #Section: 22C:016:A06 #ID: 00719596 def collinearityTest(pointList): n=len(pointList) a=0 #a indicates the first position in pointList b=1 #b indicates the first position in pointList c=2 #c indicates the first position in pointList #loop to generate all possible collinear points while a<b<c<=n-1: #loop to generate all possible collinear points when a is unchanged while b<c<=n-1: #loop to generate all possible collinear points when b is unchanged while c<=n-1: #test if points are collinear if areCollinear(pointList[a],pointList[b],pointList[c]): return[pointList[a],pointList[b],pointList[c]] c=c+1 #change c b=b+1 #change b c=b+1 #to ensure c is greater than b a=a+1 #change a b=a+1 #to ensure b is greater than a c=b+1 #to ensure c is greater than b #if there is no output, return an empty list if not areCollinear(pointList[a],pointList[b],pointList[c]): return [] def areCollinear(p1, p2, p3): a=float(p1[0]) #Changes the number of x,y coordinate to float, b=float(p2[0]) #since there is a case that when an integer divided c=float(p3[0]) #by another integer, the output would also be

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.
• Fall '13
• MichaelColbert
• Geometry, Zhaoyang Dai, possible collinear points

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern