コード例 #1
0
    def checkPointInBounds(self, pos):
        # spherical coords format for pos. (r, theta, phi)
        # Return true if point is within bounds and false if it is out of bounds.

        outBounds = False

        if pos[2] <= self.phi1:
            outBounds = True
            if self.verbose == 1:
                print("phi1 violation")

        if pos[2] >= self.phi2:
            outBounds = True
            if self.verbose == 1:
                print("phi2 violation")

        if pos[1] <= self.theta1:
            outBounds = True
            if self.verbose == 1:
                print("theta1 violation")

        if pos[1] >= self.theta2:
            outBounds = True
            if self.verbose == 1:
                print("theta2 violation")

        if outBounds == True:
            inBounds = False
        else:
            inBounds = True

        if inBounds:
            inBounds = NBB.checkPointInBounds(self, pos)

        return inBounds
コード例 #2
0
    def checkPointInBounds(self, pos):
        # cylindrical coords format for pos. Return true if point is within bounds and false if it is out of bounds.

        # assume point is inBounds and test for outBoundness
        outBounds = False

        if pos[2] < self.z1:
            outBounds = True
            if self.verbose == 1:
                print("z1 violation")

        if pos[2] > self.z2:
            outBounds = True
            if self.verbose == 1:
                print("z2 violation")

        if pos[1] < self.phi1:
            outBounds = True
            if self.verbose == 1:
                print("phi1 violation")

        if pos[1] > self.phi2:
            outBounds = True
            if self.verbose == 1:
                print("phi2 violation")

        if (pos[0] < self.radiusX) and (pos[0] < self.radiusY):
            outBounds = True
            if self.verbose == 1:
                print("radius inner violation")

        if (pos[0] > self.radiusX) and (pos[0] > self.radiusY):
            outBounds = True
            if self.verbose == 1:
                print("radius outer violation")

        if outBounds == True:
            inBounds = False
        else:
            inBounds = True

        if inBounds:
            inBounds = NBB.checkPointInBounds(self, pos)

        return inBounds