- Timestamp:
- Jun 22, 2019, 9:56:59 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2623 r2624 292 292 1.57079632679 293 293 >>> angle_vectors2D([0.,1.], [1.,0.]) 294 1.57079632679294 -1.57079632679 295 295 """ 296 296 fname = 'angle_vectors2D' … … 310 310 311 311 return theta 312 313 print angle_vectors2D([1.,0.], [0.,1.])314 print angle_vectors2D([0.,1.], [1.,0.])315 316 quit()317 312 318 313 def max_coords_poly(polygon): … … 1577 1572 """ 1578 1573 fname = 'pile_polygons' 1579 1580 Npolys = len(polygons) 1574 pilepolygons = dict(polygons) 1575 1576 Npolys = len(polyns) 1581 1577 ipoly = polygons[polyns[Npolys-1]] 1582 1578 iNpts = ipoly.shape[0] 1583 pilepolygons = ipoly1584 1579 1585 1580 pilesortpolys = polyns[::-1] 1586 1581 pilesortpolys.remove(polyns[Npolys-1]) 1582 newipoly = [] 1587 1583 for polyn in pilesortpolys: 1588 1584 poly = polygons[polyn] … … 1591 1587 nvertexa=iNpts, nvertexb=Npts, nvertexab=iNpts*Npts, polya=ipoly, \ 1592 1588 polyb=poly) 1593 iip=0 1594 for ip in Nint: 1595 newipoly = ipoly[iip:inti] 1596 1589 Npi=0 1590 for ip in range(Nint): 1591 # Determine side of the point of the polygon to cut 1592 # Here are assumed that all polygons are clockwise created, thus any 1593 # cutting point will lay to the left side of the face which cuts 1594 # but we need to deterime if it is the starting point or the ending point 1595 # the one which lays to the left of the over pile polygon 1596 iip = inti[ip] 1597 iip1 = iip + 1 1598 if iip1 > iNpts-1: iip1=0 1599 pip = intp[ip] 1600 pip1 = pip + 1 1601 if pip1 > Npts-1: pip1=0 1602 1603 iface = ipoly[iip,:]-poly[pip,:] 1604 pface = poly[pip1,:]-poly[pip,:] 1605 ifangle=angle_vectors2D(pface,iface) 1606 1607 iface = ipoly[iip1,:]-poly[pip,:] 1608 pface = poly[pip1,:]-poly[pip,:] 1609 efangle=angle_vectors2D(pface,iface) 1610 1611 if ifangle < 0.: 1612 # Initial point of the cuted face to the left of the overlying polygon 1613 for iv in range(Npi,Npi+iip): newipoly.append(ipoly[iv,:]) 1614 Npi = Npi + iip 1615 newipoly.append([gen.fillvalueF, gen.fillvalueF]) 1616 1617 elif efangle < 0.: 1618 # Ending point of the cuted face to the left of the overlying polygon 1619 newipoly.append([gen.fillvalueF, gen.fillvalueF]) 1620 newipoly.append(ipoly[iip1,:]) 1621 Npi = iip1 1622 else: 1623 print errormsg 1624 print ' ' + fname + ': No left point found !!' 1625 print ' for pile face' 1626 1627 pilepolygons[polyns[Npolys-1]] = newipoly 1597 1628 1598 1629 return pilepolygons
Note: See TracChangeset
for help on using the changeset viewer.