def fits_corner(self, pC, pOrig, p1, p2 ) : ''' fits a point onto a corner in a motif. returns true if the distances d1 (pC - p1) and d2 (pC - p2) are within 1*delta of c the angles pC-p2-pOrig and pC-p2-pOrig are within rho degrees of 90 note that the actual p0 being evaluated is p1 or p2, and pOrig is a point next to p0 ''' if GridPoint(pC) in self.connectivity: return False if p1 is None or p2 is None: return False c = self.critdist() distance_cond_1 = within_distance(c, pC, p1, self.delta) distance_cond_2 = within_distance(c, pC, p2, self.delta) angle_cond_1 = is_perpend(pC-p1, pOrig-p1, self.rho) angle_cond_2 = is_perpend(pC-p2, pOrig-p2, self.rho) return (distance_cond_1 and distance_cond_2 and angle_cond_1 and angle_cond_2)
def fits_corner(self, pC, pOrig, p1, p2): ''' fits a point onto a corner in a motif. returns true if the distances d1 (pC - p1) and d2 (pC - p2) are within 1*delta of c the angles pC-p2-pOrig and pC-p2-pOrig are within rho degrees of 90 note that the actual p0 being evaluated is p1 or p2, and pOrig is a point next to p0 ''' if GridPoint(pC) in self.connectivity: return False if p1 is None or p2 is None: return False c = self.critdist() distance_cond_1 = within_distance(c, pC, p1, self.delta) distance_cond_2 = within_distance(c, pC, p2, self.delta) angle_cond_1 = is_perpend(pC - p1, pOrig - p1, self.rho) angle_cond_2 = is_perpend(pC - p2, pOrig - p2, self.rho) return (distance_cond_1 and distance_cond_2 and angle_cond_1 and angle_cond_2)
def fits_line(self, pJ, p0, p1): ''' compares the angle p1-p0-pJ. return true if the distance d (p0-pJ) is c*(1-delta) < d < c*(1+delta) where c is critdist() the angle p1-p0-pJ is within rho degrees of 180 ''' if GridPoint(pJ) in self.connectivity: return False #import pdb #pdb.set_trace() c = self.critdist() distance_cond = within_distance(c, p0, pJ, self.delta) angle_cond = is_parallel(pJ - p0, p1 - p0, self.rho_loose) return (distance_cond and angle_cond)
def fits_line(self, pJ, p0, p1): ''' compares the angle p1-p0-pJ. return true if the distance d (p0-pJ) is c*(1-delta) < d < c*(1+delta) where c is critdist() the angle p1-p0-pJ is within rho degrees of 180 ''' if GridPoint(pJ) in self.connectivity: return False #import pdb #pdb.set_trace() c = self.critdist() distance_cond = within_distance(c, p0, pJ, self.delta) angle_cond = is_parallel(pJ-p0, p1-p0, self.rho_loose) return (distance_cond and angle_cond)
def fits_parallel(self, pJ, p0, p1, pX, pZ): ''' fits a point parallel to a corner returns true if the distance d (p0-pJ) is within 1*delta of c the angle pC-p0-p1 is within rho degrees of 90 the line pC-p0 is parallel to pX-pZ within rho_strict degrees here, p0 is the actual p0 next to pJ unlike in the above method ''' if GridPoint(pJ) in self.connectivity: return False if p1 is None or pX is None or pZ is None: return False c = self.critdist() distance_cond = within_distance(c, pJ, p0, self.delta) angle_cond = is_perpend(pJ - p0, p1 - p0, self.rho) parallel_cond = is_parallel(pJ - p0, pZ - pX, self.rho_strict) return (distance_cond and angle_cond and parallel_cond)
def fits_parallel(self, pJ, p0, p1, pX, pZ): ''' fits a point parallel to a corner returns true if the distance d (p0-pJ) is within 1*delta of c the angle pC-p0-p1 is within rho degrees of 90 the line pC-p0 is parallel to pX-pZ within rho_strict degrees here, p0 is the actual p0 next to pJ unlike in the above method ''' if GridPoint(pJ) in self.connectivity: return False if p1 is None or pX is None or pZ is None: return False c = self.critdist() distance_cond = within_distance(c, pJ, p0, self.delta) angle_cond = is_perpend(pJ-p0, p1-p0, self.rho) parallel_cond = is_parallel(pJ-p0, pZ-pX, self.rho_strict) return (distance_cond and angle_cond and parallel_cond)
def fits_cross_motif(self, pJ, p0, p1, p2 ): ''' compares the angle p1-p0-pJ. p0 is the point being extended and pJ is the point being considered. Returns true if the following conditions are true: the distance d (p0-pJ) is c*(1-delta) < d < c*(1+delta) where c is critdist() the angle p1-p0-pJ is within rho degrees of 90 the angle p1-p0-pJ is within rho_strict degrees of the angle p1-p0-p2 ''' if GridPoint(pJ) in self.connectivity: return False c = self.critdist() distance_cond = within_distance(c, p0, pJ, self.delta) angle_cond = is_perpend(pJ-p0, p1-p0, self.rho_loose) #angle_cond = True rel_angle_cond = (np.abs( angle(pJ-p0, p1-p0) - angle(p1-p0, p2-p0) ) < self.rho) #rel_angle_cond = True return (distance_cond and angle_cond and rel_angle_cond)
def fits_cross_motif(self, pJ, p0, p1, p2): ''' compares the angle p1-p0-pJ. p0 is the point being extended and pJ is the point being considered. Returns true if the following conditions are true: the distance d (p0-pJ) is c*(1-delta) < d < c*(1+delta) where c is critdist() the angle p1-p0-pJ is within rho degrees of 90 the angle p1-p0-pJ is within rho_strict degrees of the angle p1-p0-p2 ''' if GridPoint(pJ) in self.connectivity: return False c = self.critdist() distance_cond = within_distance(c, p0, pJ, self.delta) angle_cond = is_perpend(pJ - p0, p1 - p0, self.rho_loose) #angle_cond = True rel_angle_cond = ( np.abs(angle(pJ - p0, p1 - p0) - angle(p1 - p0, p2 - p0)) < self.rho) #rel_angle_cond = True return (distance_cond and angle_cond and rel_angle_cond)