def _init_align(self): """ Return """ local2_in = False local2_out = False if self.radio != 0: self.in_local = Base.cloth_local(self.radio, self.a_in) self.out_local = Base.cloth_local(self.radio, self.a_out) alpha = self._alpha() else: alpha = 0 p_center = self._center() if self.dat1['a_out'] < 0 and self.radio != 0: local2_out = Base.cloth_local(self.dat1['radio'], self.dat1['a_out']) self.cloth_in = Base.Clothoid(self.a_in, self.radio, self.recta1.azimuth(), 'in', local2_out, p_center) self.recta1.pend = self.cloth_in.pnt_d if self.dat1['a_out'] < 0 and self.radio != 0: self.recta1.pstart = self.cloth_in.pnt_p if self.radio == 0: az_ini = self.recta1.azimuth() else: az_ini = Base.azimut(p_center, self.cloth_in.pnt_r) self.curve = Base.Curve(self.radio, alpha, az_ini, p_center) if self.dat2['a_in'] < 0: local2_in = Base.cloth_local(self.dat2['radio'], self.dat2['a_in']) self.cloth_out = Base.Clothoid(self.a_out, self.radio, self.recta2.azimuth(), 'out', local2_in, p_center) self.straight = Base.Straight(self.recta1.pstart, self.recta1.pend, None, None)
def _curve_high_low(self, pnt_center, pnt_1, dat1, dat2): """ Return """ # R1>R2 # Calculamos los puntos de tangencia de la clotoide con los dos circulo out_local = Base.cloth_local(dat1['radio'], dat1['a_out']) in_local = Base.cloth_local(dat2['radio'], dat2['a_in']) azi_in = pnt_center.azimuth(pnt_1) alpha = dat2['dc_'] / dat2['radio'] if dat1['radio'] > 0 and dat2['radio'] > 0: g90 = math.pi / 2 elif dat1['radio'] < 0 and dat2['radio'] < 0: g90 = -math.pi / 2 else: raise ValueError( "Error: For change the radio sing a straight must be \ between the radios") # return [None, None, None] pnt_t1 = pnt_center.project(abs(dat1['radio'] + out_local['y_o']), azi_in - out_local['tau']) pnt_t2 = pnt_t1.project(in_local['x_o'] - out_local['x_o'], azi_in - out_local['tau'] + g90) pnt_ad2 = pnt_t1.project(out_local['x_o'], azi_in - out_local['tau'] + g90) pnt_c2 = pnt_t2.project(abs(dat2['radio'] + in_local['y_o']), azi_in - out_local['tau'] + 2 * g90) pnt_ar2 = pnt_c2.project( abs(dat2['radio'], azi_in - out_local['tau'] + in_local['tau'])) pnt_ra2 = pnt_c2.project( abs(dat2['radio']), azi_in - out_local['tau'] + in_local['tau'] + alpha) if dat2['a_in'] != 0: cloth = Base.Clothoid(dat2['a_in'], dat2['radio'], pnt_ad2.azimuth(pnt_t2), 'in', None, pnt_c2) self.list_aligns.append() self.straight_curve_lengs.append(cloth.length()) curve = Base.Curve(dat2['radio'], alpha, pnt_c2.azimuth(pnt_ar2), pnt_c2) self.list_aligns.append(curve) self.straight_curve_lengs.append(curve.length()) return pnt_c2, pnt_ra2, Base.Straight(pnt_ad2, pnt_t1)
def _curve_low_high(self, pnt_center, pnt_1, dat1, dat2): """Return""" # R1<R2 out_local = Base.cloth_local(dat1["radio"], dat1["a_out"]) in_local = Base.cloth_local(dat2["radio"], dat2["a_in"]) azi_in = pnt_center.azimuth(pnt_1) alpha = dat2["dc_"] / dat2["radio"] if dat1["radio"] > 0 and dat2["radio"] > 0: g90 = math.pi / 2 elif dat1["radio"] < 0 and dat2["radio"] < 0: g90 = -math.pi / 2 else: raise ValueError("Error: For change the radio sing a straight \ must be between the radios") # return (None, None, None) pnt_t1 = pnt_center.project(abs(dat1["radio"] + out_local["y_o"]), azi_in + out_local["tau"]) pnt_t2 = pnt_t1.project(in_local["x_o"] - out_local["x_o"], azi_in + out_local["tau"] + g90) pnt_da1 = pnt_t1.project(out_local["x_o"], azi_in + out_local["tau"] + g90) pnt_c2 = pnt_t2.project(abs(dat2["radio"] + in_local["y_o"]), azi_in + out_local["tau"] + 2 * g90) pnt_ra2 = pnt_c2.project( abs(dat2["radio"]), azi_in + out_local["tau"] - in_local["tau"] + alpha) if dat1["a_out"] != 0: cloth = Base.Clothoid( dat1["a_out"], dat1["radio"], pnt_t1.azimuth(pnt_da1), "out", None, pnt_c2, ) self.list_aligns.append(cloth) self.straight_curve_lengs.append(cloth.length()) curve = Base.Curve(dat2["radio"], alpha, pnt_c2.azimuth(pnt_ra2), pnt_c2) self.list_aligns.append(curve) self.straight_curve_lengs.append(curve.length()) return pnt_c2, pnt_ra2, Base.Straight(pnt_t1, pnt_da1)
def _staight_curve(self, pnt_center, pnt_1, dat1, dat2): """ Return """ # R1 = 0 y R2 != 0 in_local = Base.cloth_local(dat2['radio'], dat2['a_in']) alpha = dat2['dc_'] / dat2['radio'] azi_in = pnt_center.azimuth(pnt_1) pnt_ad = pnt_center.project(dat1['lr_'], azi_in) pnt_t2 = pnt_ad.project(in_local['x_o'], azi_in) if dat2['radio'] > 0: g90 = math.pi / 2 else: g90 = -math.pi / 2 pnt_c2 = pnt_t2.project(abs(dat2['radio'] + in_local['y_o']), azi_in + g90) pnt_c2.npk = dat1['lr_'] az_in_c = azi_in + in_local['tau'] - g90 if az_in_c < 0: az_in_c += 2 * math.pi pnt_ra = pnt_c2.project(abs(dat2['radio']), az_in_c + alpha) pnt_ra.npk = dat1['lr_'] if dat2['a_in'] != 0: cloth = Base.Clothoid(dat2['a_in'], dat2['radio'], azi_in, 'in', None, pnt_c2) self.list_aligns.append(cloth) self.straight_curve_lengs.append(cloth.length()) curve = Base.Curve(dat2['radio'], abs(alpha), az_in_c, pnt_c2) self.list_aligns.append(curve) self.straight_curve_lengs.append(curve.length()) return pnt_c2, pnt_ra, Base.Straight(pnt_center, pnt_ad)
def _curve_straight(self, pnt_center, pnt_1, dat1, dat2): """ Return """ # R1 != 0 y R2 = 0 out_local = Base.cloth_local(dat1['radio'], dat1['a_out']) azi_in = pnt_center.azimuth(pnt_1) # pnt_ra = pnt_1 if dat1['radio'] > 0: g90 = math.pi / 2 else: g90 = -math.pi / 2 pnt_t1 = pnt_center.project(abs(dat1['radio'] + out_local['y_o']), azi_in + out_local['tau']) pnt_da = pnt_t1.project(out_local['x_o'], azi_in + out_local['tau'] + g90) azi_out = pnt_center.azimuth(pnt_t1) + g90 if dat1['a_out'] == 0: # pnt_da = pnt_ra pnt_da = pnt_1 else: cloth = Base.Clothoid(dat1['a_out'], dat1['radio'], azi_out, 'out', None, pnt_center) self.list_aligns.append(cloth) self.straight_curve_lengs.append(cloth.length()) pnt_out = pnt_da.project(dat2['lr_'], azi_in + out_local['tau'] + g90) recta = Base.Straight(pnt_da, pnt_out) self.list_aligns.append(recta) self.straight_curve_lengs.append(recta.length()) return pnt_da, pnt_out, Base.Straight(pnt_da, pnt_out)