c++ - What is best approach for performing operations on pairs of 2d lines? -
so have 10 000 lines defined on 2d plane each line presented (a1, a2, b1, b2) (a, b points). have array of functions need perform on each pair of lines:
angle(a,b) return atan((b.y-a.y) / (b.x-a.x)) nearlyparallel(angle1, angle2) delta = abs(angle1-angle2) return (delta < threshold) or (delta > pi-threshold) collinear(a,b, c,d) return nearlyparallel(angle(a,c), angle(b,d)) , nearlyparallel(angle(a,d), angle(b,c))
so need line collinear , 1 nearlyparallel each line.
i need in c++ using boost , opensource library needed. under windows in visual studio 2010.
what library, , part can me in organizing fast calculations data? example boost graph lib helpful? mean need perform thread/processors optimizations speeding up. , not have fancy video card perform all...
you use angle function on every line , store result in std::map, using angle key. bring lines similar angles close together, can choose pairs test nearlyparallel , collinear.
Comments
Post a Comment