示例#1
0
def fetch_pids_ttol(pnts: MatrixVector, psys: PanelSystem, ztol: float=0.01, ttol: float=0.1):
    shp = pnts.shape
    pnts = pnts.reshape((-1, 1))
    numpnt = pnts.shape[0]
    numpnl = len(psys.pnls)
    pidm = zeros((1, numpnl), dtype=int)
    wintm = zeros((numpnt, numpnl), dtype=bool)
    abszm = zeros((numpnt, numpnl), dtype=float)
    for pnl in psys.pnls.values():
        pidm[0, pnl.ind] = pnl.pid
        wintm[:, pnl.ind], abszm[:, pnl.ind] = pnl.within_and_absz_ttol(pnts[:, 0], ttol=ttol)
    abszm[wintm is False] = float('inf')
    minm = argmin(abszm, axis=1)
    minm = array(minm).flatten()
    pidm = array(pidm).flatten()
    pids = pidm[minm]
    pids = matrix([pids], dtype=int).transpose()
    indp = arange(numpnt)
    minz = array(abszm[indp, minm]).flatten()
    minz = matrix([minz], dtype=float).transpose()
    chkz = minz < ztol
    pids[logical_not(chkz)] = 0
    pids = pids.reshape(shp)
    chkz = chkz.reshape(shp)
    return pids, chkz
示例#2
0
 def within_and_absz_ttol(self, pnts: MatrixVector, ttol: float = 0.1):
     shp = pnts.shape
     pnts = pnts.reshape((-1, 1))
     rgcs = pnts - self.pnto
     wint = full(pnts.shape, False)
     absz = full(pnts.shape, float('inf'))
     for i in range(self.num):
         dirx = self.dirxab[0, i]
         diry = self.diryab[0, i]
         dirz = self.dirzab[0, i]
         xy1 = ones((pnts.shape[0], 3), dtype=float)
         xy1[:, 1] = rgcs * dirx
         xy1[:, 2] = rgcs * diry
         t123 = xy1 * self.baryinv[i].transpose()
         mint = t123.min(axis=1)
         chk = mint > -ttol
         wint[chk] = True
         abszi = absolute(rgcs * dirz)
         abszi[logical_not(chk)] = float('inf')
         absz = minimum(absz, abszi)
     wint = wint.reshape(shp)
     absz = absz.reshape(shp)
     return wint, absz