Пример #1
0
 def pointsAroundP(self, complexnumberP, n):
     P = extendedValue(complexnumberP)
     if P == oo:
         raise myInputError(str(P), "The point must be finite")
     else:
         theta = numpy.linspace(0, 2 * numpy.pi, n)
         return P + numpy.cos(theta) + ((numpy.sin(theta)) * (1j))
Пример #2
0
 def loxCurve(self, complexP, complexQ, theta, n):
     P = extendedValue(complexP)
     Q = extendedValue(complexQ)
     try:
         areAllDistinctArgs(P, Q)
     except myInputError:
         raise myInputError(
             str(P) + "," + str(Q), "The points must be distinct")
     coordList = []
     complexZ = (1.1) * (numpy.cos(theta) + (numpy.sin(theta) * (1j)))
     #complexZ = numpy.exp(numpy.sin(theta))*(numpy.cos(-numpy.cos(theta))+(numpy.sin(-numpy.cos(theta))*(1j)))
     t = numpy.linspace(0, 10, 500)
     if isooInArgs(P, Q) == True:
         for k in range(0, n, 1):
             rotation = numpy.cos(
                 k * 2 * numpy.pi / n) + (numpy.sin(k * 2 * numpy.pi / n) *
                                          (1j))
             complexW = ((complexZ)**(t**2)) * rotation
             x_coord = (complexW).real
             y_coord = (complexW).imag
             coordList.append([x_coord, y_coord])
     else:
         for k in range(0, n, 1):
             rotation = numpy.cos(
                 k * 2 * numpy.pi / n) + (numpy.sin(k * 2 * numpy.pi / n) *
                                          (1j))
             complexW = ((complexZ)**(t**2)) * rotation
             x_coord = ((Q * complexW + P) / (complexW + 1)).real
             y_coord = ((Q * complexW + P) / (complexW + 1)).imag
             coordList.append([x_coord, y_coord])
             x_coord2 = ((P * complexW + Q) / (complexW + 1)).real
             y_coord2 = ((P * complexW + Q) / (complexW + 1)).imag
             coordList.append([x_coord2, y_coord2])
     return coordList
Пример #3
0
 def eCenterAndRadiusNonVertGeodesicThroughPAndQ(self, hpointP, hpointQ):
     P, Q = extendedValue(hpointP), extendedValue(hpointQ)
     if self.areVertAlignedInUHP(P, Q) == False:
         normal = (Q - P).imag + (P - Q).real * (1j)
         midpoint = (P + Q) / 2
         eCenter = midpoint + (-(midpoint.imag) / (normal.imag)) * (normal)
         eRadius = numpy.absolute(P - eCenter)
         return [eCenter, eRadius]
     else:
         raise myInputError(
             str(P) + ',' + str(Q),
             "The points must be distinct, belong to the UHP, and not be vertically alligned"
         )
Пример #4
0
 def pointsOnMediatrix(self, complexnumberP, complexnumberQ, n):
     P = extendedValue(complexnumberP)
     Q = extendedValue(complexnumberQ)
     try:
         areAllDistinctArgs(P, Q)
     except myInputError:
         raise myInputError(
             str(P) + "," + str(Q), "The points must be distinct")
     if isooInArgs(P, Q) == True:
         raise myInputError(
             str(P) + "," + str(Q), "Both points must be finite")
     else:
         midPoint = (P + Q) / 2
         halfDifference = (P - Q) / 2
         a = numpy.real(halfDifference)
         b = numpy.imag(halfDifference)
         orthogonal = numpy.complex(b + (-a) * (1j))
         numpyLeftInterval = numpy.arange(-n, 0, 1)  #(-(n-1)/2,0,1)
         numpyRightInterval = numpy.arange(1, 1 + n, 1)  #(1,1+(n-1)/2,1)
         numpyInterval = numpy.linspace(
             -n, n, n)  #numpy.union1d(numpyLeftInterval,numpyRightInterval)
         return midPoint + numpyInterval * orthogonal
Пример #5
0
    def linesThroughPFunction(
        self, complexnumberP
    ):  ##PERSONAL NOTE: Should I try to curry the functions that have functions as outputs?
        P = extendedValue(complexnumberP)
        if P == oo:
            raise myInputError(str(P), "The point must be finite")
        else:

            def theFunction(complexR):
                R = numpy.complex(complexR)
                return [[R.real, R.imag], P]

            vectorized = numpy.vectorize(theFunction)
            return vectorized
Пример #6
0
    def circlesThroughPFunction(self, complexnumberP):
        P = extendedValue(complexnumberP)
        if P == oo:
            raise myInputError(str(P), "The point must be finite")
        else:

            def theFunction(
                complexnumberR
            ):  ## Makes R the center of circle passing through P.
                R = numpy.complex(complexnumberR)
                center = [numpy.real(R), numpy.imag(R)]
                radius = numpy.absolute(R - P)
                return [center, radius]

            vectorized = numpy.vectorize(theFunction)
            return vectorized
Пример #7
0
 def common_circlesFunction(self, complexnumberP, complexnumberQ, n):
     # The case when isooInArgs(P,Q) == True may no longer be necessary.
     # I think I should delete it and perhaps add isooInArgs(P,Q)==False in the try statement.
     P = extendedValue(complexnumberP)
     Q = extendedValue(complexnumberQ)
     try:
         areAllDistinctArgs(P, Q)
     except myInputError:
         raise myInputError(
             str(P) + "," + str(Q), "The points must be distinct")
     if isooInArgs(P, Q) == True:
         finitePoint = (removeooFromList([P, Q]))[0]
         theFunction = self.linesThroughPFunction(finitePoint)
         pointsAroundFinitePoint = self.pointsAroundP(finitePoint, n)
         return theFunction(pointsAroundFinitePoint)
     else:
         theFunction = self.circlesThroughPFunction(complexnumberP)
         points_on_mediatrix = self.pointsOnMediatrix(
             complexnumberP, complexnumberQ, n)
         return theFunction(points_on_mediatrix)
Пример #8
0
    def UHPCircSegmentParamByArcLength(self, center, radius, theta1, theta2):
        x0, y0, r = center.real, center.imag, radius
        if y0 <= 0 or y0 <= r:
            raise myInputError(
                str(y0) + ',' + str(r),
                "Center must have positive imaginary part and euclidean radius must be smaller than imaginary part of center"
            )
        else:
            totalarclength = (4 * r / numpy.sqrt(y0**2 - r**2)) * numpy.arctan(
                (y0 * numpy.tan(theta2 / 2) + r) / numpy.sqrt(y0**2 - r**2)
            ) - (4 * r / numpy.sqrt(y0**2 - r**2)) * numpy.arctan(
                (y0 * numpy.tan(theta1 / 2) + r) / numpy.sqrt(y0**2 - r**2))

            def parametrization(s):
                theta = 2 * numpy.arctan(
                    ((numpy.sqrt(y0**2 - r**2) * numpy.tan(
                        (s + (4 * r / numpy.sqrt(y0**2 - r**2)) * numpy.arctan(
                            (y0 * numpy.tan(theta1 / 2) + r) / numpy.sqrt(
                                y0**2 - r**2))) * numpy.sqrt(y0**2 - r**2) /
                        (4 * r))) - r) / y0)
                return x0 + r * numpy.cos(theta) + (
                    y0 + r * numpy.sin(theta)) * (1j)

            return [parametrization, totalarclength]