Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. //get all combinations of 4 distinct points from the collection
  2. foreach(getFourPoints in collection.AllFourPointCombinations()){
  3.  
  4. //make two lines from the points
  5. line1=line(getFourPoints.p1,getFourPoints.p2);
  6. line2=line(getFourPoints.p3,getFourPoints.p4);
  7.  
  8. //find the intersection of the lines
  9. intersection=line1.intersect(line2);
  10.  
  11. //check if the intersection is not yet in the point collection
  12. if (!collection.points.includes(intersection)){
  13. //add intersection to the point collection
  14. collection.points.add(intersection);
  15.  
  16. //add the lines to the existing graph of lines
  17. addToGraph(line1,line2);
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement