Пример #1
0
    def AngleLMCalc(self,CP,LMP):

        CP2 = CP + (1,0)
        Xline = Line (CP, CP2) #x-Line
        INPoints = self.InterPointCalc(CP,LMP) #Calculate outside Points of LM from CP
        if len(INPoints)==2:
            ln1=Line(CP,INPoints[0])
            Ang1= Xline.smallest_angle_between(ln1).evalf() #Angle of 1 LMpoint to X
            ln2=Line(CP,INPoints[1])
            Ang2 = Xline.smallest_angle_between(ln2).evalf() #Angle of 2 LMpoint to X
            if  INPoints[0].args[1]<0: # if negativ Y angle negativ  
                if  INPoints[0].args[0]>0: # if positiv  X angle positiv
                    Ang1 = 2 * np.pi - Ang1
                else:
                    Ang1 = Ang1 + np.pi
            elif INPoints[0].args[0]<0: # if negativ  X angle negativ
                Ang1 = np.pi - Ang1

            if  INPoints[1].args[1]<0: # if negativ Y angle negativ  
                if  INPoints[1].args[0]>0: # if positiv  X angle positiv
                    Ang2 = 2 * np.pi - Ang2
                else:
                    Ang2 = Ang2 + np.pi
            elif INPoints[1].args[0]<0: # if negativ  X angle negativ
                Ang2 = np.pi - Ang2

            SiceAngle = abs(Ang1-Ang2) # AngleSice
            HalfAngle = (Ang1+Ang2)/2
            if SiceAngle > np.pi:
                SiceAngle = 2* np.pi - SiceAngle
                HalfAngle = HalfAngle - np.pi 
        else:
            Ang1 = 0
            Ang2 = 0
            SiceAngle = 0
            HalfAngle = 0

        return [SiceAngle,HalfAngle,Ang1,Ang2]