Exemplo n.º 1
0
 def addBaum(self, inpDat, iTp, cP, yrG=0):
     angP = Fkt.drawDst(inpDat.dI[iTp]['dAngKPlr_E'][1]['k'], self.cM,
                        self.dIA['dMinMax']['AngPol'])
     angA = Fkt.drawDst(inpDat.dI[iTp]['dAngKAzm_E'][1]['k'], self.cM,
                        self.dIA['dMinMax']['AngAzm'])
     Fkt.adjustAngles(angP, angA)
     self.lB.append(
         Baum(inpDat, self.cMk, iTp, np.array(cP), yrG, angP[0], angA[0]))
Exemplo n.º 2
0
 def __init__(self,
              dInA,
              dInTp,
              cMk,
              dFAdj,
              dFPE,
              dAnEP,
              dAnEA,
              IDZw,
              lPathID,
              yrGrm=0,
              ageBm=0,
              vS=P0,
              sD='s',
              vDPrv=vUz,
              vDCur=vUz,
              cAnV=0.,
              cAnR=0.,
              lenZw=1.,
              lFDstK=[1],
              ageZw=1):
     self.dIA = dInA
     self.dITp = dInTp
     self.cMk = cMk
     self.cM = self.dIA['Mode']
     self.IDZ = IDZw
     self.pathID = lPathID
     self.yrG = yrGrm
     self.ageB = ageBm
     self.pS = vS
     self.sDir = sD
     self.vDirP = vDPrv
     self.vDirC = vDCur
     self.lFDsE = Fkt.drawDst(dFPE[self.sDir], self.cM,
                              self.dIA['dMinMax']['FctPEZw'])
     self.lAnEP = Fkt.drawDst(dAnEP[self.sDir], self.cM,
                              self.dIA['dMinMax']['AngPol'])
     self.lAnEA = Fkt.drawDst(dAnEA[self.sDir], self.cM,
                              self.dIA['dMinMax']['AngAzm'])
     #         Fkt.adjustAngles(self.lAnEP, self.lAnEA)
     self.cAnVZ = cAnV
     self.cAnRZ = cAnR
     self.getSegments(lenZw)
     self.lFDsK = lFDstK
     self.vDsK = np.array([cFctK * self.lenZ for cFctK in self.lFDsK],
                          float)
     self.getCoordKt()
     self.arrX = np.array([self.pS[0]] + [cP[0] for cP in self.lPSegE])
     self.arrY = np.array([self.pS[1]] + [cP[1] for cP in self.lPSegE])
     self.arrZ = np.array([self.pS[2]] + [cP[2] for cP in self.lPSegE])
     self.dFAd = dFAdj
     self.ageZ = ageZw
Exemplo n.º 3
0
 def pinchKnospen(self, dPrPKKt, tMnMx):
     if self.ageZ <= 1:  # pinch out Knospen
         for cKKt in self.lKKt:
             prPinch = Fkt.drawDst(dPrPKKt[self.sDir], self.cM, tMnMx)
             if np.random.uniform() < prPinch:
                 cKKt.becomeInact()
                 self.lNumKs[0] += 1
                 self.lNumKs[1] -= 1
Exemplo n.º 4
0
 def growBlaetter(self):
     self.lBt = []
     tOffsAngAzm = self.dITp['dOffsAngAzm'][self.nKKt][self.sDir]
     self.offsAngAzm = Fkt.drawDst(tOffsAngAzm, self.cM,
                                   self.dIA['dMinMax']['AngAzm'])
     if self.dIA['modelBlatt']:
         vN = Fkt.findRotAxis(self.vDirC, self.sZwTp, self.dIA['tolAngV'])
         for iKKt in range(self.nKKt):
             cAnBtPlr = self.lAnKPlr[iKKt] * self.dITp['fAngBlattPlr']
             cAnKsAzm = self.lAnKAzm[iKKt] + self.offsAngAzm * self.iKtZw
             cAnBtPlr, cAnKsAzm = Fkt.adjustAngPA(cAnBtPlr, cAnKsAzm)
             vR = Fkt.rotatePt3D(self.vDirC, vN, cAnBtPlr)
             vDB = Fkt.rotatePt3D(vR, self.vDirC, cAnKsAzm)
             self.lBt.append(self.growBlatt(vDB, iKKt))
Exemplo n.º 5
0
 def getSegments(self, lenZw):
     assert len(self.pS) == 3 and len(self.vDirC) == 3
     if self.dIA['lvlDbg'] > 0 and (self.pS[2] < 0 or lenZw <= 0):
         print('self.pS[2] =', self.pS[2], '/', 'lenZw =', lenZw)
     assert self.pS[2] >= 0 and lenZw > 0
     assert (len(self.lFDsE) == len(self.lAnEP)
             and len(self.lAnEP) == len(self.lAnEA))
     nE = len(self.lFDsE)
     lDirSg, lPSgE = [V0_3D] * (nE + 1), [V0_3D] * (nE + 1)
     lLenSg = [0.] * (nE + 1)
     cAngChDr = Fkt.drawDst(self.dITp['dAngChDr'][self.sDir], self.cM,
                            self.dIA['dMinMax']['AngPol'])
     lInpV = [
         0,
         np.array([cKS for cKS in self.pS]), self.vDirC, lenZw,
         self.dITp['dPosZweig'][self.sDir], cAngChDr, self.dIA['tolAngV']
     ]
     # lInpV: [pRC, pSC, vDC, lenC, cSPosZweig, cAngChDr, angTol]
     Fkt.constructSeg(lDirSg, lPSgE, lLenSg, nE, lInpV, self.lFDsE,
                      self.lAnEP, self.lAnEA)
     assert len(lDirSg) == len(lPSgE) and len(lDirSg) == len(lLenSg)
     self.lDirSeg, self.lPSegE, self.lLenSeg = lDirSg, lPSgE, lLenSg
     self.pE, self.lenZ = self.lPSegE[-1], sum(self.lLenSeg)
Exemplo n.º 6
0
 def pinchZweig(self, cZw, lZwRm, cPrPZw, tMnMx):
     prPinch = Fkt.drawDst(cPrPZw, self.cM, tMnMx)
     if np.random.uniform() < prPinch:
         lZwRm.append(cZw)  # remove this one
Exemplo n.º 7
0
 def __init__(self,
              dInA,
              dInTp,
              cMk,
              dFAdj,
              IDKntn=0,
              lPathID=[],
              iKntnZw=0,
              yrGrm=0,
              ageBm=0,
              ageZw=-1,
              lenZw=0.,
              pCA=P0,
              pR=0.,
              sPKntn='End',
              sD='s',
              vDPrv=vUz,
              vDCur=vUz,
              nKntnZw=1,
              nKKntn=1,
              isAct=True):
     assert len(pCA) == 3 and len(vDPrv) == 3 and len(vDCur) == 3
     self.dIA = dInA
     self.dITp = dInTp
     self.cMk = cMk
     self.cM = self.dIA['Mode']
     self.IDKt = IDKntn
     self.pathID = lPathID
     self.iKtZw = iKntnZw
     self.yrG = yrGrm
     self.ageB = ageBm
     self.ageZ = ageZw
     self.lenZ = lenZw
     self.pKC = pCA
     self.pKR = pR
     self.sPKt = sPKntn
     self.fAct = isAct
     self.sDir = sD
     self.vDirP = vDPrv
     self.vDirC = vDCur
     self.sZwTp = self.dITp['dPosZweig'][self.sDir]
     self.nKZw = nKntnZw
     self.nKKt = nKKntn
     self.dFAd = dFAdj
     dAnKPlr = self.dITp['dAngKPlr'][self.nKKt]
     dAnKAzm = self.dITp['dAngKAzm'][self.nKKt]
     if self.sPKt == 'End':
         dAnKPlr = self.dITp['dAngKPlr_E'][self.nKKt]
         dAnKAzm = self.dITp['dAngKAzm_E'][self.nKKt]
     self.lAnKPlr = Fkt.drawDst(dAnKPlr[self.sDir], self.cM,
                                self.dIA['dMinMax']['AngPol'],
                                self.dFAd['AngPol'])
     self.lAnKAzm = Fkt.drawDst(dAnKAzm[self.sDir], self.cM,
                                self.dIA['dMinMax']['AngAzm'],
                                self.dFAd['AngAzm'])
     Fkt.adjustAngles(self.lAnKPlr, self.lAnKAzm)
     self.lNumKs = [0, 0]
     self.lKKt = []
     self.lZw = []
     self.lIDPinch = []
     self.pinchIt = False
     self.addToBlock()
     self.growBlaetter()