def generateBolts4Tunnel3(centerX , centerY , hAxesLength , vAxesLength \ , cornerHeight , boltLength , boltLength2 , boltsDistance ): import DDACalcTools bolts = DDACalcTools.pyBolts() print bolts.size() DDACalcTools.calcBolts4Type3Tunnel( float(centerX) , float(centerY) , float(hAxesLength) , float(vAxesLength) \ , float(cornerHeight) , float(boltLength) , float(boltLength2) , float(boltsDistance) , bolts) return TunnelBoltsGenerator._convert2BoltElements(bolts)
def generateBolts4Tunnel4(centerX , centerY , radius , cornerHeight \ , ifRotate , boltLength , boltLength2 , boltsDistance ): import DDACalcTools bolts = DDACalcTools.pyBolts() print bolts.size() DDACalcTools.calcBolts4Type4Tunnel( float(centerX) , float(centerY) , float(radius), float(cornerHeight) \ , float(ifRotate) , float(boltLength) , float(boltLength2) , float(boltsDistance) , bolts) return TunnelBoltsGenerator._convert2BoltElements(bolts)
def generateBolts4Tunnel2(centerX , centerY , halfWidth , halfHeight \ , arcHeight , boltLength , boltLength2 , boltsDistance ): import DDACalcTools bolts = DDACalcTools.pyBolts() print bolts.size() DDACalcTools.calcBolts4Type2Tunnel( float(centerX) , float(centerY) , float(halfWidth), float(halfHeight) \ , float(arcHeight) , float(boltLength) , float(boltLength2) , float(boltsDistance) , bolts) return TunnelBoltsGenerator._convert2BoltElements(bolts)
def generateBolts4Tunnel1(centerX , centerY , hAxesLength , vAxesLength \ , boltLength , boltLength2 , boltsDistance ): import DDACalcTools bolts = DDACalcTools.pyBolts() print bolts.size() # DDACalcTools.calcBolts4Type2Tunnel( float(centerX) , float(centerY) , float(hAxesLength) \ # , float(vAxesLength) , float(boltLength) , float(boltLength2) , float(boltsDistance) , bolts) DDACalcTools.calcBolts4Type1Tunnel( centerX , centerY , hAxesLength \ , vAxesLength , boltLength , boltLength2 , boltsDistance , bolts) return TunnelBoltsGenerator._convert2BoltElements(bolts)
def triangulate(plist2): pnts = pl() if plist2[0]==plist2[-1]: plist = plist2[:-1] else: plist = plist2 for t in plist: pnts.append(point(t[0],t[1])) result = pl() Py.triangulate(pnts , result) tmpRe = [] for i , t in enumerate(result): tmpRe.append(Vector(t.x,t.y,-1)) return tmpRe
def generateBolts(centerX , centerY , halfWidth , halfHeight \ , arcRadius , boltsDistance , boltLength , boltLength2 ): import DDACalcTools bolts = DDACalcTools.pyBolts() print bolts.size() DDACalcTools.calcBolts4Type2Tunnel( centerX , centerY , halfWidth, halfHeight \ , arcRadius , boltLength , boltLength2 , boltsDistance , bolts) from loadDataTools import BoltElement resultBolts=[] for bolt in bolts: p1 = ( bolt.startPoint.x , bolt.startPoint.y , 0 ) p2 = ( bolt.endPoint.x , bolt.endPoint.y , 0 ) resultBolts.append(BoltElement(p1 , p2 , 0 , 0 , 0)) print "(%lf , %lf) (%lf , %lf)"%(bolt.startPoint.x \ ,bolt.startPoint.y , bolt.endPoint.x,bolt.endPoint.y) return resultBolts
def ifSegmentAndPolygonIntersect(segment2 , polygon2): seg = pl() poly = pl() polygon = polygon2 if polygon2[0]==polygon2[-1]: polygon = polygon2[:-1] for t in segment2: seg.append(point(t[0],t[1])) for t in polygon: poly.append(point(t[0],t[1])) return Py.ifIntersection(seg , poly)