>>> %pylab inline Populating the interactive namespace from numpy and matplotlib
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg
Geomutil là một mô -đun tập hợp các chức năng hình học khác nhau được sử dụng trong các mô -đun của trụ khác. is a module which gathers different geometrical functions used in other module of pylayers.
Lớp này thực hiện biểu đồ tầm nhìn, của một đa giác.
Lớp đa giác là một lớp con của lớp đa giác hình dạng. Nó cho phép khởi tạo một đa giác với các đối tượng khác nhau [list, np.array, sh.multipoint]
>>> points = shg.MultiPoint[[[0, 0], [1, 1], [2, 0], [1, 0],[0,-2]]] >>> poly1 = Polygon[points] >>> poly2 = Polygon[p=[[3,4,4,3],[1,1,2,2]]] >>> N = 7 >>> phi = np.linspace[0,2*np.pi,N] >>> x = 3*np.cos[phi]+5 >>> y = 3*np.sin[phi]+5 >>> nppoints = np.vstack[[x,y]] >>> poly3 = Polygon[nppoints]
âm mưu đa giác
>>> fig = plt.figure[] >>> ax = fig.gca[] >>> plt.axis['off'] >>> plt.axis['equal'] >>> fig,ax=poly1.plot[color='green',fig=fig,ax=ax] >>> fig,ax=poly2.plot[color='red',fig=fig,ax=ax] >>> fig,ax=poly3.plot[color='#000000',fig=fig,ax=ax]
buildgv []¶
Mối quan hệ hiển thị dertermine trong một đa giác. Trả về một biểu đồ
Chức năng này được sử dụng để xác định mối quan hệ hiển thị trong môi trường trong nhà.
>>> fig = plt.figure[figsize=[8,8]] >>> points = shg.MultiPoint[[[0, 0], [0, 1], [2.5,1], [2.5, 2], \ ... [2.8,2], [2.8, 1.1], [3.2, 1.1], \ ... [3.2, 0.7], [0.4, 0.7], [0.4, 0]]] >>> polyg = Polygon[points] >>> Gv = polyg.buildGv[show=True] >>> plt.axis['off'] [-0.5, 4.0, -0.5, 2.5]
TypeErrorTraceback [most recent call last] in [] 2 points = shg.MultiPoint[[[0, 0], [0, 1], [2.5,1], [2.5, 2], [2.8,2], [2.8, 1.1], [3.2, 1.1], [3.2, 0.7], [0.4, 0.7], [0.4, 0]]] 3 polyg = Polygon[points] ----> 4 Gv = polyg.buildGv[show=True] 5 plt.axis['off'] 6 [-0.5, 4.0, -0.5, 2.5] /home/uguen/Documents/rch/devel/pylayers/pylayers/util/geomutil.pyc in buildGv[self, **kwargs] 1367 # 1368 if kwargs['show']: -> 1369 points1 = shg.MultiPoint[lring] 1370 for k, pt in enumerate[points1]: 1371 if k in uconvex: /home/uguen/anaconda2/lib/python2.7/site-packages/shapely/geometry/multipoint.pyc in __init__[self, points] 54 super[MultiPoint, self].__init__[] 55 ---> 56 if points is None or len[points] == 0: 57 # allow creation of empty multipoints, to support unpickling 58 pass TypeError: object of type 'LinearRing' has no len[]
Các lớp Geomview
Geomvect class¶
Lớp này được sử dụng để tương tác với Trình xem 3D Geomview.
geomomase¶
Hiển thị một cơ sở
>>> v1 = np.array[[1,0,0]] >>> v2 = np.array[[0,1,0]] >>> v3 = np.array[[0,0,1]] >>> M = np.vstack[[v1,v2,v3]] >>> gv = GeomVect['test'] >>> gv.geomBase[M] >>> #gv.show3[]
điểm trong
Hiển thị một tập hợp các điểm
>>> gv1 = GeomVect['test1'] >>> gv1.points[np.random.rand[3,10]] >>> #gv1.show3[]
Phương thức Ndarray chuyển đổi một đối tượng đa giác thành một ndarray
>>> geo = Geomoff['test2'] >>> pt = poly3.ndarray[].T >>> pt1 = np.hstack[[pt,np.zeros[[7,1]]]]
Lớp này được sử dụng trong mô -đun vrml2geom
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax0
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax1
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax2
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax3
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax4
âm mưu hộp
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax5
Các chức năng tiện ích¶
góc cạnh
góc cạnh chuyển đổi một vectơ 3D thành góc hình cầu 2, được biểu thị bằng radian
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax6
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax7
lớp lơn
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax8
DPTSEG [P, PT, PH] ¶
Hàm này tính toán khoảng cách giữa một tập hợp các điểm và một phân đoạn
File "", line 2 Populating the interactive namespace from numpy and matplotlib ^ SyntaxError: invalid syntax9
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg0
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg1
sự biểu lộ
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg2
Ptonseg [PTA, PHE, PT] ¶
được sử dụng trong select.py
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg3
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg4
ptconvex¶
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg5
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg6
giao nhau¶
Giao nhau [a, b, c, d] wether hay không các phân đoạn N [AB] giao với các phân đoạn N [CD]. Giao lộ chỉ được kiểm tra cho phân đoạn của cùng một chỉ số trong ndarray.
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg7
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg8
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg9
>>> points = shg.MultiPoint[[[0, 0], [1, 1], [2, 0], [1, 0],[0,-2]]] >>> poly1 = Polygon[points] >>> poly2 = Polygon[p=[[3,4,4,3],[1,1,2,2]]] >>> N = 7 >>> phi = np.linspace[0,2*np.pi,N] >>> x = 3*np.cos[phi]+5 >>> y = 3*np.sin[phi]+5 >>> nppoints = np.vstack[[x,y]] >>> poly3 = Polygon[nppoints]0
>>> from pylayers.util.geomutil import * >>> from pylayers.util.plotutil import * >>> import matplotlib.pyplot as plt >>> import shapely.geometry as shg8
>>> points = shg.MultiPoint[[[0, 0], [1, 1], [2, 0], [1, 0],[0,-2]]] >>> poly1 = Polygon[points] >>> poly2 = Polygon[p=[[3,4,4,3],[1,1,2,2]]] >>> N = 7 >>> phi = np.linspace[0,2*np.pi,N] >>> x = 3*np.cos[phi]+5 >>> y = 3*np.sin[phi]+5 >>> nppoints = np.vstack[[x,y]] >>> poly3 = Polygon[nppoints]2
>>> points = shg.MultiPoint[[[0, 0], [1, 1], [2, 0], [1, 0],[0,-2]]] >>> poly1 = Polygon[points] >>> poly2 = Polygon[p=[[3,4,4,3],[1,1,2,2]]] >>> N = 7 >>> phi = np.linspace[0,2*np.pi,N] >>> x = 3*np.cos[phi]+5 >>> y = 3*np.sin[phi]+5 >>> nppoints = np.vstack[[x,y]] >>> poly3 = Polygon[nppoints]3
>>> points = shg.MultiPoint[[[0, 0], [1, 1], [2, 0], [1, 0],[0,-2]]] >>> poly1 = Polygon[points] >>> poly2 = Polygon[p=[[3,4,4,3],[1,1,2,2]]] >>> N = 7 >>> phi = np.linspace[0,2*np.pi,N] >>> x = 3*np.cos[phi]+5 >>> y = 3*np.sin[phi]+5 >>> nppoints = np.vstack[[x,y]] >>> poly3 = Polygon[nppoints]4
Các chức năng hữu ích
>>> points = shg.MultiPoint[[[0, 0], [1, 1], [2, 0], [1, 0],[0,-2]]] >>> poly1 = Polygon[points] >>> poly2 = Polygon[p=[[3,4,4,3],[1,1,2,2]]] >>> N = 7 >>> phi = np.linspace[0,2*np.pi,N] >>> x = 3*np.cos[phi]+5 >>> y = 3*np.sin[phi]+5 >>> nppoints = np.vstack[[x,y]] >>> poly3 = Polygon[nppoints]5
>>> points = shg.MultiPoint[[[0, 0], [1, 1], [2, 0], [1, 0],[0,-2]]] >>> poly1 = Polygon[points] >>> poly2 = Polygon[p=[[3,4,4,3],[1,1,2,2]]] >>> N = 7 >>> phi = np.linspace[0,2*np.pi,N] >>> x = 3*np.cos[phi]+5 >>> y = 3*np.sin[phi]+5 >>> nppoints = np.vstack[[x,y]] >>> poly3 = Polygon[nppoints]6
>>> points = shg.MultiPoint[[[0, 0], [1, 1], [2, 0], [1, 0],[0,-2]]] >>> poly1 = Polygon[points] >>> poly2 = Polygon[p=[[3,4,4,3],[1,1,2,2]]] >>> N = 7 >>> phi = np.linspace[0,2*np.pi,N] >>> x = 3*np.cos[phi]+5 >>> y = 3*np.sin[phi]+5 >>> nppoints = np.vstack[[x,y]] >>> poly3 = Polygon[nppoints]7
>>> points = shg.MultiPoint[[[0, 0], [1, 1], [2, 0], [1, 0],[0,-2]]] >>> poly1 = Polygon[points] >>> poly2 = Polygon[p=[[3,4,4,3],[1,1,2,2]]] >>> N = 7 >>> phi = np.linspace[0,2*np.pi,N] >>> x = 3*np.cos[phi]+5 >>> y = 3*np.sin[phi]+5 >>> nppoints = np.vstack[[x,y]] >>> poly3 = Polygon[nppoints]8
>>> points = shg.MultiPoint[[[0, 0], [1, 1], [2, 0], [1, 0],[0,-2]]] >>> poly1 = Polygon[points] >>> poly2 = Polygon[p=[[3,4,4,3],[1,1,2,2]]] >>> N = 7 >>> phi = np.linspace[0,2*np.pi,N] >>> x = 3*np.cos[phi]+5 >>> y = 3*np.sin[phi]+5 >>> nppoints = np.vstack[[x,y]] >>> poly3 = Polygon[nppoints]9