API Reference

API Reference

Exported types

(type) Annulus

Representation of the region between two circles.

Annulus(radouter,radinner)
Annulus(radouter,radinner,center)

Construct a concentric annulus of outer radius radouter and inner radius radinner centered at center. If the center is not given, the origin is used.

(type) Arc{T<:AnyComplex} in the complex plane

Each Arc type is parameterized according to the common type of its complex input arguments.

ComplexRegions.ArcMethod.
Arc(C,start,delta)

Consruct an arc that is the part of the Circle C starting at parameter value start and ending at start+delta. The values are expressed in terms of fractions of a complete circle. The start value should be in [0,1), and delta should be in [-1,1].

Arc(a,b,c)

Construct the arc starting at point a, passing through b, and ending at c. If the three points are collinear, a Segment is returned instead.

(type) Circle{T<:AnyComplex} in the complex plane

Each Circle type is parameterized according to the common type of its complex input arguments.

Circle(zc,r,ccw=true)

Construct the circle with given center zc, radius r, and orientation (defaults to counterclockwise).

Circle(a,b,c)

Construct the circle passing through the given three numbers. Orientation is determined so that the values are visited in the given order. If the three points are collinear (including when one of the given values is infinite), a Line is returned instead.

(type) CircularPolygon

Type for closed paths consisting entirely of arcs, segments, and rays.

CircularPolygon(p::AbstractPath; tol=<default>) 
CircularPolygon(p::AbstractVector; tol=<default>)

Construct a circular polygon from a (possibly closed) path, or from a vector of curves. The tol parameter is a tolerance used when checking continuity and closedness of the path.

(type) Smooth closed curve defined by an explicit function of a real paramerter in [0,1].

ClosedCurve(f; tol=<default>)
ClosedCurve(f,a,b; tol=<default)

Construct a ClosedCurve object from the complex-valued function point accepting an argument in the interval [0,1]. The constructor checks whether f(0)≈f(1) to tolerance tol. If a and b are given, they are the limits of the parameter in the call to the supplied f. However, the resulting object will be defined on [0,1], which is internally scaled to [a,b].

ClosedCurve(f,df[,a,b]; tol=<default>)

Construct a closed curve with point location and tangent given by the complex-valued functions f and df, respectively, optionally with given limits on the parameter.

(type) ClosedPath

Generic implementation of an AbstractClosedPath.

ClosedPath(c::AbstractVector; tol=<default>)
ClosedPath(P::Path; tol=<default>)

Given a vector c of curves, or an existing path, construct a closed path. The path is checked for continuity (to tolerance tol) at all of the vertices.

(type) ConnectedRegion{N}

Representation of a N-connected region in the extended complex plane.

ConnectedRegion(outer,inner)

Construct an open connected region by specifying its boundary components. The outer boundary could be nothing or a closed curve or path. The inner boundary should be a vector of one or more nonintersecting closed curves or paths. The defined region is interior to the outer boundary and exterior to all the components of the inner boundary, regardless of the orientations of the given curves.

(type) Smooth curve defined by an explicit function of a real paramerter in [0,1].

Curve(f)
Curve(f,a,b)

Construct a Curve object from the complex-valued function f accepting an argument in the interval [0,1]. If a and b are given, they are the limits of the parameter in the call to the supplied f. However, the resulting object will be defined on [0,1], which is internally scaled to [a,b].

Curve(f,df[,a,b])

Construct a curve with point location and tangent given by the complex-valued functions f and df, respectively, optionally with given limits on the parameter.

(type) Line{T<:AnyComplex} in the complex plane

Each Line type is parameterized according to the common type of its complex input arguments.

Line(a,b)

Construct the line passing through the two given points.

Line(a,direction=z)

Construct the line through the given point and parallel to the complex sign of the given direction value.

(type) Möbius

Representation of a Möbius or bilinear transformation.

Möbius(a,b,c,d)

Construct the Möbius map $z ↦ (az+b)/(cz+d)$ by giving its coefficients.

Möbius(z::AbstractVector,w::AbstractVector)

Construct the Möbius map that transforms the points z[k] to w[k] for k=1,2,3. Values of Inf are permitted in both vectors.

Möbius(A::AbstractMatrix)

Construct the Möbius map $z ↦ (az+b)/(cz+d)$ by giving a matrix A==[a b;c d].

f(z::Number)

Evaluate the Möbius map f at a real or complex value z.

f(C::Union{Arc,Segment})

Find the image of the arc or segment C under the Möbius map f. The result is also either an Arc or a Segment.

Möbius(C1,C2)

Construct a Möbius map that transforms the curve C1 to C2. Both curves must be either a Line or Circle. (These maps are not uniquely determined.)

f(C::Union{Circle,Line})

Find the image of the circle or line C under the Möbius map f. The result is also either a Circle or a Line.

f(R::Union{AbstractDisk,AbstractHalfplane})

If R is an AbstractDisk or an AbstractHalfplane, find its image under the Möbius map f. The result is also either an AbstractDisk or an AbstractHalfplane.

Examples

julia> f = Möbius(Line(-1,1),Circle(0,1))
Möbius transformation:

   (1.0 + 0.9999999999999999im) z + (3.666666666666666 - 1.666666666666667im)
   ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
   (1.0 + 0.9999999999999999im) z + (-1.666666666666666 + 3.6666666666666665im)

julia> f(upperhalfplane)
Disk interior to:
   Circle(-5.55112e-17+2.22045e-16im,1.0)

julia> isapprox(ans,unitdisk)
true
(type) Path

Generic implementation of an AbstractPath.

Path(c::AbstractVector; tol=<default>)

Given a vector c of curves, construct a path. The path is checked for continuity (to tolerance tol) at the interior vertices.

(type) Polygon

Type for closed paths consisting entirely of segments and rays.

Polygon(v::AbstractVector)

Construct a polygon from a vector of its vertices. Each element of v should be either a finite vertex, or a tuple of two angles that indicate the angles of two rays incident to an infinite vertex: one "to" infinity, and a second "from" infinity.

Polygon(p::AbstractPath; tol=<default>) 
Polygon(p::AbstractVector{T<:AbstractCurve}; tol=<default>)

Construct a polygon from a (possibly closed) path, or from a vector of curves. The tol parameter is a tolerance used when checking continuity and closedness of the path.

(type) Ray{T<:AnyComplex} in the complex plane

Each Ray type is parameterized according to the common type of its complex input arguments.

Ray(a,θ,reverse=false)

Construct the ray starting at a and extending to infinity at the angle θ. If reverse is true, the ray is considered to extend from infinity to a at angle .

(type) RegionIntersection

Representation of the intersection of two regions.

(type) RegionUnion

Representation of the union of two regions.

(type) Segment{T<:AnyComplex} in the complex plane

Each Segment type is parameterized according to the common type of its complex input arguments.

Segment(a,b)

Consruct a segment that starts at value a and ends at b.

Polar(::AbstractCurve)

Interpret a curve as having points of type Polar.

Spherical(::AbstractCurve)

Interpret a curve as having points of type Spherical.

Exported functions

Base.:!Method.
!(R::SimplyConnectedRegion)

Compute the region complementary to R. This is not quite set complementation, as neither region includes its boundary. The complement is always simply connected in the extended plane.

Base.:+Method.
X + z
z + X

Translate a curve, path, or region X by a complex number z.

Base.:-Method.
z - X

Negate a curve, path, or region X (reflect through the origin) and translate by z.

Base.:-Method.
X - z

Translate a curve, path, or region X by a number -z.

Base.:-Method.
-X

Negate a curve, path, or region X (reflect through the origin).

Base.:∘Method.
∘(f::Möbius,g::Möbius)

Compose two Möbius transformations.

Base.conjMethod.
conj(X)

Construct the complex conjugate of curve, path, or region X. (Reverses the orientation of a curve or path.)

Base.inMethod.
in(z::Number,R::AbstractRegion;tol=<default>)
z ∈ R   (type "\in" followed by tab)

True if z is in the region R.

Base.intersectFunction.
intersect(c1::AbstractCurve,c2::AbstractCurve; tol=<default>)

Find the intersection(s) of two curves. The result could be a vector of zero or more values, or a curve.

Base.intersectMethod.
intersect(R1::AbstractRegion,R2::AbstractRegion)
R1 ∩ R2    (type "\cap" followed by tab key)

Create the region that is the intersection of R1 and R2.

Base.invMethod.
inv(A)

Invert the arc A through the origin. In general the inverse is an Arc, though the result is a Segment if the arc's circle passes through the origin.

Base.invMethod.
inv(C)

Invert the circle C through the origin. In general the inverse is a Circle, though the result is a Line if C passes through the origin.

Base.invMethod.
inv(L)

Invert a line L through the origin. In general the inverse is a Circle through the inverse of any three points on the line.

Base.invMethod.
inv(f::Möbius)

Find the inverse of a Möbius transformation. This is the functional inverse, not 1/f(z).

Base.invMethod.
inv(R)

Invert the ray R through the origin. In general the inverse is an Arc.

Base.invMethod.
inv(S)

Invert the segment S through the origin. In general the inverse is an Arc, though the result is a Segment if S would pass through the origin when extended.

Base.invMethod.
inv(X)

Invert a curve, path, or region pointwise.

Base.isapproxMethod.
isapprox(A1::Arc,A2::Arc; tol=<default>) 
A1 ≈ A2

Determine if A1 and A2 represent the same arc, irrespective of the type or values of its parameters. Identity is determined by agreement within tol, which is interpreted as the weaker of absolute and relative differences.

Base.isapproxMethod.
isapprox(C1::Circle,C2::Circle; tol=<default>) 
C1 ≈ C2

Determine if C1 and C2 represent the same circle, irrespective of the type or values of its parameters. Identity is determined by agreement within tol, which is interpreted as the weaker of absolute and relative differences.

Base.isapproxMethod.
isapprox(P1::AbstractPath,R2::AbstractPath; tol=<default>)
P1 ≈ P2       (type "\approx" followed by tab key)

Determine whether P1 and P2 represent the same path, up to tolerance tol, irrespective of the parameterization of its curves.

Base.isapproxMethod.
isapprox(L1::Line,L2::Line; tol=<default>) 
L1 ≈ L2

Determine if L1 and L2 represent the same line, irrespective of the type or values of its parameters. Identity is determined by agreement within tol, which is interpreted as the weaker of absolute and relative differences.

Base.isapproxMethod.
isapprox(R1::Ray,R2::Ray; tol=<default>) 
R1 ≈ R2

Determine if R1 and R2 represent the same segment, irrespective of the type or values of its parameters. Identity is determined by agreement within tol, which is interpreted as the weaker of absolute and relative differences.

Base.isapproxMethod.
isapprox(S1::Segment,S2::Segment; tol=<default>) 
S1 ≈ S2

Determine if S1 and S2 represent the same segment, irrespective of the type or values of its parameters. Identity is determined by agreement within tol, which is interpreted as the weaker of absolute and relative differences.

Base.isapproxMethod.
isapprox(R1::SimplyConnectedRegion,R2::SimplyConnectedRegion; tol=<default>)

Determine whether R1 and R2 represent the same region, up to tolerance tol. Equivalently, determine whether their boundaries are the same.

Base.isfiniteMethod.
isfinite(C::AbstractCurve)

Return true if the curve is bounded in the complex plane (i.e., does not pass through infinity).

Base.isfiniteMethod.
isfinite(P::AbstractPath)

Return true if the path is bounded in the complex plane (i.e., does not pass through infinity).

Base.isfiniteMethod.
isfinite(R::AbstractRegion)

Return true if the region is bounded in the complex plane.

Base.reverseMethod.
reverse(X)

Construct a curve or path identical to X except with opposite direction of parameterization.

Base.truncateMethod.
truncate(P::Union{CircularPolygon,Polygon},C::Circle)

Compute a trucated form of the polygon by replacing each pair of rays incident at infinity with two segments connected by an arc along the given circle. This is not a true clipping of the polygon, as finite sides are not altered. The result is either a CircularPolygon or the original P.

Base.truncateMethod.
truncate(P::Union{CircularPolygon,Polygon})

Apply truncate to P using a circle that is centered at the centroid of its finite vertices, and a radius twice the maximum from the centroid to the finite vertices.

Base.unionMethod.
union(R1::AbstractRegion,R2::AbstractRegion)
R1 ∪ R2    (type "\cup" followed by tab key)

Create the region that is the union of R1 and R2.

angles(P::Polygon)

Compute a vector of interior angles at the vertices of the polygon P. At a finite vertex these lie in (0,2π]; at an infinite vertex, the angle is in [-2π,0].

arclength(P::Path)

Compute the arclength of the path P.

arclength(X)

Fetch or compute the arc length of the curve or path X.

Example

julia> ellipse = ClosedCurve( t->cos(t)+2im*sin(t), 0,2π );
julia> arclength(ellipse)  # good to about 10 digits
9.688448219981513
ComplexRegions.argMethod.
arg(A::Arc,z)

Find the parameter argument t such that A(t)==z is true.

This gives undefined results if z is not actually on the arc.

ComplexRegions.argMethod.
arg(C::Circle,z)

Find the parameter argument t such that C(t)==z is true.

This gives undefined results if z is not actually on the circle.

ComplexRegions.argMethod.
arg(L::Line,z)

Find a parameter argument t such that L(t)==z is true. For an infinite z, return zero (but note that L(1) is also infinity).

This gives undefined results if z is not actually on the line.

ComplexRegions.argMethod.
arg(R::Ray,z)

Find the parameter argument t such that R(t)==z is true.

This gives undefined results if z is not actually on the ray.

ComplexRegions.argMethod.
arg(S::Segment,z)

Find the parameter argument t such that S(t)==z is true.

This gives undefined results if z is not actually on the segment.

between(outer,inner)

Construct the region interior to the closed curve or path outer and interior to inner.

closest(z,A::Arc)

Find the point on arc A that lies closest to z.

closest(z,C::Circle)

Find the point on circle C that lies closest to z.

closest(z,P::AbstractPath)

Find the point on the path P that lies closest to z.

closest(z,L::Line)

Find the point on line L that lies closest to z.

closest(z,R::Ray)

Find the point on ray R that lies closest to z.

closest(z,S::Segment)

Find the point on segment S that lies closest to z.

curve(P::AbstractClosedPath,k::Integer)

Return the kth curve in the path P. The index is applied circularly; e.g, if the closed path has n curves, then ...,1-n,1,1+n,... all refer to the first curve.

curve(P::AbstractPath,k::Integer)

Return the kth curve in the path P.

curves(P::AbstractPath)

Return an array of the curves that make up the path P.

disk(C::Circle)

Construct the disk interior to C.

disk(center::Number,radius::Real)

Construct the disk with the given center and radius.

dist(z,A::Arc)

Compute the distance from number z to the arc A.

dist(z,C::Circle)

Compute the distance from number z to the circle C.

dist(z,P::AbstractPath)

Find the distance from the path P to the point z.

dist(z,L::Line)

Compute the distance from number z to the line L.

dist(z,R::Ray)

Compute the distance from number z to the ray R.

dist(z,S::Segment)

Compute the distance from number z to the segment S.

exterior(C)

Construct the region exterior to the closed curve or path C. If C is bounded, the bounded enclosure is chosen regardless of the orientation of C; otherwise, the region "to the right" is the exterior.

halfplane(L::Line)

Construct the half-plane to the left of L.

halfplane(a,b)

Construct the half-plane to the left of the line from a to b.

interior(C)

Construct the region interior to the closed curve or path C. If C is bounded, the bounded enclosure is chosen regardless of the orientation of C; otherwise, the region "to the left" is the interior.

isinside(X,z)

Detect whether z lies inside the closed curve or path X. For a bounded path, this always means the bounded region enclosed by the curve, regardless of orientation; for an unbounded path, it means the region "to the left" as one walks along the path.

isleft(z,L::Line)

Determine whether the number z lies "to the left" of line L. This means that the angle it makes with tangent(L) is in the interval (0,π).

Note that isleft and isright are not logical opposites; a point on the curve should give false in both cases.

isleft(z,R::Ray)

Determine whether the number z lies "to the left" of ray R. This means that the angle it makes with tangent(R) is in the interval (0,π).

Note that isleft and isright are not logical opposites; a point on the (extended) ray should give false in both cases.

isleft(z,S::Segment)

Determine whether the number z lies "to the left" of segment S. This means that the angle it makes with tangent(S) is in the interval (0,π).

Note that isleft and isright are not logical opposites; a point on the (extended) segment should give false in both cases.

isoutside(X,z)

Detect whether z lies outside the closed curve or path X. For a bounded path, this always means the unbounded region complementary to the enclosure of the curve, regardless of orientation; for an unbounded path, it means the region "to the right" as one walks along the path.

ispositive(p::CircularPolygon)

Determine whether the circular polygon is positively oriented (i.e., circulates counterclockwise around the points it encloses).

ispositive(p::Polygon)

Determine whether the polygon is positively oriented (i.e., circulates counterclockwise around the points it encloses).

isright(z,L::Line)

Determine whether the number z lies "to the right" of line L. This means that the angle it makes with tangent(L) is in the interval (-π,0).

Note that isleft and isright are not logical opposites; a point on the curve should give false in both cases.

isright(z,R::Ray)

Determine whether the number z lies "to the right" of ray R. This means that the angle it makes with tangent(R) is in the interval (-π,0).

Note that isleft and isright are not logical opposites; a point on the (extended) ray should give false in both cases.

isright(z,S::Segment)

Determine whether the number z lies "to the right" of segment S. This means that the angle it makes with tangent(S) is in the interval (-π,0).

Note that isleft and isright are not logical opposites; a point on the (extended) segment should give false in both cases.

n_gon(n)

Construct a regular n-gon with vertices on the unit circle.

normal(C::AbstractCurve,t::Real)

Find the unit complex number in the direction of the leftward-pointing normal to curve C at parameter value t in [0,1].

normal(P::AbstractPath,t::Real)

Compute a complex-valued normal to path P at parameter value t. Values of t in [k,k+1] correspond to values in [0,1] along curve k of the path, for k = 1,2,...,length(P)-1. The result is not well-defined at an integer value of t.

plotdata(C::AbstractCurve,n=501)

Compute n points along the curve C suitable to make a plot of it.

point(C::AbstractCurve,t::Real)

Find the point on curve C at parameter value t, which should lie in the interval [0,1].

point(C::AbstractCurve,t::AbstractArray)

Vectorize the point function for curve C.

point(P::AbstractPath,t::Real)
P(t)

Compute the point along path P at parameter value t. Values of t in [k,k+1] correspond to values in [0,1] along curve k of the path, for k = 1,2,...,length(P)-1.

point(P::AbstractPath,t::AbstractVector)

Vectorize the point method for path P.

rectangle(xlim,ylim)

Construct the rectangle defined by xlim[1]< x <xlim[2],ylim[1]`< y <ylim[2]`, where z=complex(x,y).

rectangle(z1,z2)

Construct the rectangle whose opposing corners are the given complex values.

reflect(z,C::Circle)

Reflect the value z across the circle C. (For reflection of a circle through a point, use translation and negation.)

reflect(z,L::Line)

Reflect the value z across the line L. (For reflection of a line through a point, use translation and negation.)

reflect(z,S::Segment)

Reflect the value z across the extension of segment S to a line. (For reflection of a segment through a point, use translation and negation.)

tangent(C::AbstractCurve,t::Real)

Find the complex number representing the tangent to curve C at parameter value t in [0,1].

tangent(P::AbstractPath,t::Real)

Compute the complex-valued tangent along path P at parameter value t. Values of t in [k,k+1] correspond to values in [0,1] along curve k of the path, for k = 1,2,...,length(P)-1. The result is not well-defined at an integer value of t.

unittangent(C::AbstractCurve,t::Real)

Find the complex number representing the unit tangent to curve C at parameter value t in [0,1]. For Lines, Segments, and Rays, the t argument is optional.

unittangent(P::AbstractPath,t::Real)

Compute the complex-valued unit tangent along path P at parameter value t. Values of t in [k,k+1] correspond to values in [0,1] along curve k of the path, for k = 1,2,...,length(P)-1. The result is not well-defined at an integer value of t.

vertex(P::AbstractPath,k::Integer)

Return the kth vertex of the path P. The index is applied circularly; e.g, if the closed path has n curves, then ...,1-n,1,1+n,... all refer to the first vertex.

vertex(P::AbstractPath,k::Integer)

Return the kth vertex of the path P.

vertices(P::AbstractClosedPath)

Return an array of the unique vertices (endpoints of the curves) of the closed path P. The length is equal the number of curves in P, i.e., the first/last vertex is not duplicated.

vertices(P::AbstractPath)

Return an array of the vertices (endpoints of the curves) of the path P. The length is one greater than the number of curves in P.

winding(P,z)

Compute the winding number of a closed curve or path P about the point z. Each counterclockwise rotation about z contributes +1, and each clockwise rotation about it counts -1. The winding number is zero for points not in the region enclosed by P.

The result is unreliable for points lying on P, for which the problem is ill-posed.

Other functions

ComplexRegions.default()

Return a dictionary of global default settings for the ComplexRegions package.

ComplexRegions.default(key=value)

Change a global default setting in the running instance of the ComplexRegions package.