regions
regions
Region classes for the cxregions package.
This module contains all region-related classes including the base JuliaRegion class and specific region types like Interior1CRegion, Exterior1CRegion, and Annulus.
Classes
Annulus
regions.Annulus(outer, inner= None , center= 0j )
An annulus (ring-shaped region) between two circles.
This represents the region between an inner and outer circle.
Parameters
outer
float, Circle, or juliacall.AnyValue
Outer radius, outer circle, or Julia Annulus object
required
inner
float or Circle
Inner radius or inner circle
None
center
complex
Center point (if constructing from radii), default is 0
0j
Attributes
inner
Circle
Inner boundary circle
outer
Circle
Outer boundary circle
Examples
>>> # Annulus from radii
>>> annulus1 = Annulus(2 , 1 , center= 0 )
>>> # Annulus from circles
>>> from cxregions.curves import Circle
>>> inner_circle = Circle(0 , 1 )
>>> outer_circle = Circle(0 , 2 )
>>> annulus2 = Annulus(outer_circle, inner_circle)
Methods
isfinite
Check if the annulus is finite.
modulus
Compute the modulus of the annulus.
isfinite
regions.Annulus.isfinite()
Check if the annulus is finite.
Returns
bool
Always returns True for annuli
modulus
regions.Annulus.modulus()
Compute the modulus of the annulus.
Returns
float
The modulus (related to the ratio of radii)
Exterior1CRegion
regions.Exterior1CRegion(boundary)
Simply connected exterior region.
This represents the region outside a single closed curve, extending to infinity.
Parameters
boundary
ClosedCurve, ClosedPath, or juliacall.AnyValue
The boundary curve of the region
required
Attributes
boundary
ClosedCurve or ClosedPath
The boundary curve of the region
Examples
>>> from cxregions.curves import Circle
>>> circle = Circle(0 , 1 )
>>> exterior = Exterior1CRegion(circle)
Methods
isfinite
regions.Exterior1CRegion.isfinite()
Check if the region is finite.
Returns
bool
True if the boundary is finite, False otherwise
ExteriorRegion
regions.ExteriorRegion(inner)
Exterior region with multiple inner boundaries.
This represents the region outside multiple closed curves, extending to infinity.
Parameters
inner
list of ClosedCurve/ClosedPath or juliacall.AnyValue
The inner boundary curves
required
Attributes
inner
list of ClosedCurve/ClosedPath
The inner boundary curves
Examples
>>> from cxregions.curves import Circle
>>> circle1 = Circle(0 , 1 )
>>> circle2 = Circle(3 , 0.5 )
>>> exterior = ExteriorRegion([circle1, circle2])
Methods
isfinite
regions.ExteriorRegion.isfinite()
Check if the region is finite.
Returns
bool
Always returns False for exterior regions
Interior1CRegion
regions.Interior1CRegion(boundary)
Simply connected interior region.
This represents the region inside a single closed curve.
Parameters
boundary
ClosedCurve, ClosedPath, or juliacall.AnyValue
The boundary curve of the region
required
Attributes
boundary
ClosedCurve or ClosedPath
The boundary curve of the region
Examples
>>> from cxregions.curves import Circle
>>> circle = Circle(0 , 1 )
>>> interior = Interior1CRegion(circle)
Methods
isfinite
regions.Interior1CRegion.isfinite()
Check if the region is finite.
Returns
bool
True if the boundary is finite, False otherwise
InteriorConnectedRegion
regions.InteriorConnectedRegion(outer, inner= [])
Multiply connected interior region.
This represents the region inside an outer boundary but outside inner boundaries.
Parameters
outer
ClosedCurve, ClosedPath, or juliacall.AnyValue
The outer boundary curve
required
inner
list of ClosedCurve/ClosedPath
The inner boundary curves (holes)
[]
Attributes
outer
ClosedCurve or ClosedPath
The outer boundary curve
inner
list of ClosedCurve/ClosedPath
The inner boundary curves
Examples
>>> from cxregions.curves import Circle
>>> outer_circle = Circle(0 , 2 )
>>> inner_circle = Circle(0 , 1 )
>>> region = InteriorConnectedRegion(outer_circle, [inner_circle])
Methods
isfinite
regions.InteriorConnectedRegion.isfinite()
Check if the region is finite.
Returns
bool
True if all boundaries are finite, False otherwise
JuliaRegion
regions.JuliaRegion(julia_obj)
Base class for wrapping Julia region objects from ComplexRegions.jl.
This class provides a Python interface to Julia region objects, which represent areas in the complex plane bounded by curves.
Parameters
julia_obj
juliacall.AnyValue
A Julia region object from ComplexRegions.jl
required
Attributes
julia
juliacall.AnyValue
The underlying Julia region object
Methods
contains
Check if a point is contained in the region.
get
Get a field from the underlying Julia object.
innerboundary
Get the inner boundary curves of the region.
intersect
Compute the intersection of this region with another.
outerboundary
Get the outer boundary curves of the region.
union
Compute the union of this region with another.
contains
regions.JuliaRegion.contains(z= None )
Check if a point is contained in the region.
Parameters
z
complex
Point to test for containment
None
Returns
bool
True if z is in the region, False otherwise
get
regions.JuliaRegion.get(field)
Get a field from the underlying Julia object.
Parameters
field
str
Name of the field to retrieve
required
Returns
Any
The value of the requested field
innerboundary
regions.JuliaRegion.innerboundary()
Get the inner boundary curves of the region.
Returns
JuliaPath or list of JuliaPath
Inner boundary curve(s) of the region
intersect
regions.JuliaRegion.intersect(other)
Compute the intersection of this region with another.
Parameters
other
JuliaRegion
Another region to intersect with
required
Returns
JuliaRegion
Intersection of the two regions
outerboundary
regions.JuliaRegion.outerboundary()
Get the outer boundary curves of the region.
Returns
JuliaPath or list of JuliaPath
Outer boundary curve(s) of the region
union
regions.JuliaRegion.union(other)
Compute the union of this region with another.
Parameters
other
JuliaRegion
Another region to union with
required
Returns
JuliaRegion
Union of the two regions
Functions
Jordan
Construct a Jordan curve from a ClosedPath or ClosedCurve object.
between
Construct the region between two closed curves.
disk
Construct a disk as an interior region.
exterior
Construct the exterior region of a closed curve.
get_julia
Extract the Julia object from a Python wrapper.
halfplane
Construct a half-plane as an interior region from a Line.
interior
Construct the interior region of a closed curve.
wrap_jl_region
Wrap a Julia region object in the appropriate Python class.
Jordan
Construct a Jordan curve from a ClosedPath or ClosedCurve object.
Parameters
c
ClosedPath, ClosedCurve, or juliacall.AnyValue
A closed curve or path object
required
Returns
ClosedPath or ClosedCurve
The input object if already a Jordan curve, or wrapped appropriately
Raises
ValueError
If the argument is not a valid closed curve or path
between
regions.between(curve1, curve2)
Construct the region between two closed curves.
Parameters
curve1
ClosedCurve or ClosedPath
First boundary curve
required
curve2
ClosedCurve or ClosedPath
Second boundary curve
required
Returns
InteriorConnectedRegion
Region between the two curves
Examples
>>> from cxregions.curves import Circle
>>> outer = Circle(0 , 2 )
>>> inner = Circle(0 , 1 )
>>> region = between(outer, inner)
disk
regions.disk(center, radius)
Construct a disk as an interior region.
Parameters
center
complex
Center of the disk
required
radius
float
Radius of the disk
required
Returns
Interior1CRegion
Disk region
Examples
>>> disk_region = disk(1 + 1j , 2 )
exterior
Construct the exterior region of a closed curve.
Parameters
curve
ClosedCurve or ClosedPath
Boundary curve
required
Returns
Exterior1CRegion
Exterior region of the curve
Examples
>>> from cxregions.curves import Circle
>>> circle = Circle(0 , 1 )
>>> region = exterior(circle)
get_julia
Extract the Julia object from a Python wrapper.
Parameters
p
JuliaCurve, JuliaPath, or other
Python wrapper object or raw Julia object
required
Returns
juliacall.AnyValue or other
The underlying Julia object, or the input if not a wrapper
halfplane
Construct a half-plane as an interior region from a Line.
Parameters
l
Line
Line that forms the boundary of the half-plane
required
Returns
Interior1CRegion
Half-plane region
Examples
>>> from cxregions.curves import Line
>>> line = Line(0 , direction= 1 )
>>> hp = halfplane(line)
interior
Construct the interior region of a closed curve.
Parameters
curve
ClosedCurve or ClosedPath
Boundary curve
required
Returns
Interior1CRegion
Interior region of the curve
Examples
>>> from cxregions.curves import Circle
>>> circle = Circle(0 , 1 )
>>> region = interior(circle)
wrap_jl_region
regions.wrap_jl_region(jul)
Wrap a Julia region object in the appropriate Python class.
Parameters
jul
juliacall.AnyValue
A Julia region object from ComplexRegions.jl
required
Returns
JuliaRegion
The appropriate Python region wrapper
Raises
ValueError
If the argument is not a Julia object or not a recognized region type