(
        self,
        x0: list[float],
        radius: float,
        mesh_size: float | None = None,
        R=None,
        compound=False,
        num_sections: int = 3,
        holes=None,
        make_surface: bool = True,
    )
return Circle(
            x0,
            radius,
            R,
            compound,
            num_sections,
            holes,
            curve_loop,
            plane_surface,
            mesh_size=mesh_size,
        )
Add circle in the :math:`x`-:math:`y`-plane.
Add circle in the :math:`x`-:math:`y`-plane.
Add circle in the : math : x - : math : y - plane .
def add_circle(
        self,
        x0: list[float],
        radius: float,
        mesh_size: float | None = None,
        R=None,
        compound=False,
        num_sections: int = 3,
        holes=None,
        make_surface: bool = True,
    ):
        """Add circle in the :math:`x`-:math:`y`-plane."""
        if holes is None:
            holes = []
        else:
            assert make_surface

        # Define points that make the circle (midpoint and the four cardinal
        # directions).
        X = np.zeros((num_sections + 1, len(x0)))
        if num_sections == 4:
            # For accuracy, the points are provided explicitly.
            X[1:, [0, 1]] = np.array(
                [[radius, 0.0], [0.0, radius], [-radius, 0.0], [0.0, -radius]]
            )
        else:
            X[1:, [0, 1]] = np.array(
                [
                    [
                        radius * np.cos(2 * np.pi * k / num_sections),
                        radius * np.sin(2 * np.pi * k / num_sections),
                    ]
                    for k in range(num_sections)
                ]
            )

        if R is not None:
            assert np.allclose(
                abs(np.linalg.eigvals(R)), np.ones(X.shape[1])
            ), "The transformation matrix doesn't preserve circles; at least one eigenvalue lies off the unit circle."
            X = np.dot(X, R.T)

        X += x0

        # Add Gmsh Points.
        p = [self.add_point(x, mesh_size=mesh_size) for x in X]

        # Define the circle arcs.
        arcs = [
            self.add_circle_arc(p[k], p[0], p[k + 1]) for k in range(1, len(p) - 1)
        ] + [self.add_circle_arc(p[-1], p[0], p[1])]

        if compound:
            self._COMPOUND_ENTITIES.append((1, [arc._id for arc in arcs]))

        curve_loop = self.add_curve_loop(arcs)

        if make_surface:
            plane_surface = self.add_plane_surface(curve_loop, holes)
            if compound:
                self._COMPOUND_ENTITIES.append((2, [plane_surface._id]))
        else:
            plane_surface = None

        return Circle(
            x0,
            radius,
            R,
            compound,
            num_sections,
            holes,
            curve_loop,
            plane_surface,
            mesh_size=mesh_size,
        )
def add_circle ( self , x0 : list [ float ] , radius : float , mesh_size : float | None = None , R = None , compound = False , num_sections : int = 3 , holes = None , make_surface : bool = True , ) : if holes is None : holes = [ ] else : assert make_surface # Define points that make the circle (midpoint and the four cardinal # directions). X = np . zeros ( ( num_sections + 1 , len ( x0 ) ) ) if num_sections == 4 : # For accuracy, the points are provided explicitly. X [ 1 : , [ 0 , 1 ] ] = np . array ( [ [ radius , 0.0 ] , [ 0.0 , radius ] , [ - radius , 0.0 ] , [ 0.0 , - radius ] ] ) else : X [ 1 : , [ 0 , 1 ] ] = np . array ( [ [ radius * np . cos ( 2 * np . pi * k / num_sections ) , radius * np . sin ( 2 * np . pi * k / num_sections ) , ] for k in range ( num_sections ) ] ) if R is not None : assert np . allclose ( abs ( np . linalg . eigvals ( R ) ) , np . ones ( X . shape [ 1 ] ) ) , "The transformation matrix doesn't preserve circles; at least one eigenvalue lies off the unit circle." X = np . dot ( X , R . T ) X += x0 # Add Gmsh Points. p = [ self . add_point ( x , mesh_size = mesh_size ) for x in X ] # Define the circle arcs. arcs = [ self . add_circle_arc ( p [ k ] , p [ 0 ] , p [ k + 1 ] ) for k in range ( 1 , len ( p ) - 1 ) ] + [ self . add_circle_arc ( p [ - 1 ] , p [ 0 ] , p [ 1 ] ) ] if compound : self . _COMPOUND_ENTITIES . append ( ( 1 , [ arc . _id for arc in arcs ] ) ) curve_loop = self . add_curve_loop ( arcs ) if make_surface : plane_surface = self . add_plane_surface ( curve_loop , holes ) if compound : self . _COMPOUND_ENTITIES . append ( ( 2 , [ plane_surface . _id ] ) ) else : plane_surface = None return Circle ( x0 , radius , R , compound , num_sections , holes , curve_loop , plane_surface , mesh_size = mesh_size , )