1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
plx@sony:~$ python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> from shapely.geometry import LineString
>>> list_x = [ 2.*math.pi/5000*i for i in range(5001) ]
>>> courbe_sinus = [ (list_x[i],math.sin(list_x[i])) for i in range(5001) ]
>>> courbe_cosinus = [ (list_x[i],math.cos(list_x[i])) for i in range(5001) ]
>>> sinus = LineString(courbe_sinus)
>>> cosinus = LineString(courbe_cosinus)
>>> intersections = sinus.intersection(cosinus)
>>> type(intersections)
<class 'shapely.geometry.multipoint.MultiPoint'>
>>> for geom in intersections.geoms:
... print geom.wkt
...
POINT (0.7853981633974483 0.7071067811865476)
POINT (3.9269908169872418 -0.7071067811865475) |
Partager