コード例 #1
0
 def setUp(self):
     # Test of plane 4x + 2y - 4z + 3 = 0 (used in most test cases)
     self.expected_coefficients = np.array([4.0, 2.0, -4.0, 3.0], np.float_)
     self.p1 = np.array([0.0, 0.0, 0.75])
     self.p2 = np.array([-0.75, 0.0, 0.0])
     self.p3 = np.array([0.0, -1.5, 0.0])
     self.plane = Plane.from_3points(self.p1, self.p2, self.p3)
コード例 #2
0
 def setUp(self):
     #Test of plane 4x + 2y - 4z + 3 = 0 (used in most test cases)
     self.expected_coefficients = np.array([4.0, 2.0, -4.0, 3.0], np.float)
     self.p1 = np.array([0.0, 0.0, 0.75])
     self.p2 = np.array([-0.75, 0.0, 0.0])
     self.p3 = np.array([0.0, -1.5, 0.0])
     self.plane = Plane.from_3points(self.p1, self.p2, self.p3)
コード例 #3
0
        # Setting up the plane of separation
        local_plane = None
        found = False
        for npoints in range(sepplanealgo.minimum_number_of_points, min(sepplanealgo.maximum_number_of_points, 4) + 1):
            if found:
                break
            for ipoints in itertools.combinations(sepplanealgo.plane_points, npoints):
                points_combination = [lgf.local_geometry.coords[ipoint] for ipoint in ipoints]
                if npoints == 2:
                    if collinear(
                        points_combination[0], points_combination[1], lgf.local_geometry.central_site, tolerance=0.25
                    ):
                        continue
                    local_plane = Plane.from_3points(
                        points_combination[0], points_combination[1], lgf.local_geometry.central_site
                    )
                    found = True
                    break
                elif npoints == 3:
                    if collinear(points_combination[0], points_combination[1], points_combination[2], tolerance=0.25):
                        continue
                    local_plane = Plane.from_3points(
                        points_combination[0], points_combination[1], points_combination[2]
                    )
                    found = True
                    break
                elif npoints > 3:
                    local_plane = Plane.from_npoints(points_combination, best_fit="least_square_distance")
                    found = True
                    break
コード例 #4
0
        #                                                                                                testing=True)

        # Setting up the plane of separation
        local_plane = None
        found = False
        for npoints in range(sepplanealgo.minimum_number_of_points,
                             min(sepplanealgo.maximum_number_of_points, 4)+1):
            if found:
                break
            for ipoints in itertools.combinations(sepplanealgo.plane_points, npoints):
                points_combination = [lgf.local_geometry.coords[ipoint] for ipoint in ipoints]
                if npoints == 2:
                    if collinear(points_combination[0], points_combination[1],
                                 lgf.local_geometry.central_site, tolerance=0.25):
                        continue
                    local_plane = Plane.from_3points(points_combination[0], points_combination[1],
                                               lgf.local_geometry.central_site)
                    found = True
                    break
                elif npoints == 3:
                    if collinear(points_combination[0], points_combination[1], points_combination[2], tolerance=0.25):
                        continue
                    local_plane = Plane.from_3points(points_combination[0], points_combination[1], points_combination[2])
                    found = True
                    break
                elif npoints > 3:
                    local_plane = Plane.from_npoints(points_combination, best_fit='least_square_distance')
                    found = True
                    break
                else:
                    raise ValueError('Wrong number of points to initialize separation plane')