Polygons
Methods
Polygon(x::Vector{Float64}, y::Vector{Float64})
A polygon defined by its vertices, which must be provided in counter-clockwise order.
Example
julia> p = Polygon([-1.0,0.2,1.0,-1.0],[-1.0,-1.0,0.5,1.0])
Polygon with 4 vertices at
(-1.0,-1.0) (0.2,-1.0) (1.0,0.5) (-1.0,1.0)
interior angles/π = [0.5, 0.656, 0.422, 0.422]
SchwarzChristoffel.Polygons.vertex
— Function.vertex(p::Polygon) -> Vector{Complex128}
Returns the vector of vertices of the polygon p
, in complex form.
Example
julia> p = Polygon([-1.0,0.2,1.0,-1.0],[-1.0,-1.0,0.5,1.0]);
julia> vertex(p)
4-element Array{Complex{Float64},1}:
-1.0-1.0im
0.2-1.0im
1.0+0.5im
-1.0+1.0im
SchwarzChristoffel.Polygons.interiorangle
— Function.interiorangle(p::Polygon) -> Vector{Float64}
Returns the vector of interior angles (divided by $\pi$) of the polygon p
.
Example
julia> p = Polygon([-1.0,0.2,1.0,-1.0],[-1.0,-1.0,0.5,1.0]);
julia> interiorangle(p)
4-element Array{Float64,1}:
0.5
0.655958
0.422021
0.422021
Base.length
— Method.length(p::Polygon) -> Integer
Returns the number of vertices of the polygon p
.
Example
julia> p = Polygon([-1.0,0.2,1.0,-1.0],[-1.0,-1.0,0.5,1.0]);
julia> length(p)
4
Base.isinf
— Method.isinf(p::Polygon) -> Bool
Returns true
if any vertex in polygon p
is at infinity.
Example
julia> p = Polygon([-1.0,0.2,1.0,-1.0],[-1.0,-1.0,0.5,1.0]);
julia> isinf(p)
false
SchwarzChristoffel.Polygons.isinpoly
— Function.isinpoly(z::Complex128,p::Polygon) -> Bool
Returns true
or false
depending on whether z
is inside or outside polygon p
.
Example
julia> p = Polygon([-1.0,0.2,1.0,-1.0],[-1.0,-1.0,0.5,1.0]);
julia> isinpoly(0.0+0.0im,p)
true
julia> isinpoly(1.0+2.0im,p)
false
isinpoly(z::Complex128,p::Polygon,tol::Float64) -> Bool
Returns true
if z
is inside or within distance tol
of polygon p
.
Example
julia> p = Polygon([-1.0,0.2,1.0,-1.0],[-1.0,-1.0,0.5,1.0]);
julia> isinpoly(-1.01+0.0im,p)
false
julia> isinpoly(-1.01+0.0im,p,1e-2)
true
SchwarzChristoffel.Polygons.naca4
— Function.naca4(cam,pos,t[;np=20][,Zc=0.0+0.0im][,len=1.0]) -> Vector{Complex128}
Generates the vertices of a NACA 4-digit airfoil of chord length 1. The relative camber is specified by cam
, the position of maximum camber (as fraction of chord) by pos
, and the relative thickness by t
.
The optional parameter np
specifies the number of points on the upper or lower surface. The optional parameter Zc
specifies the mean position of the vertices (which is set to the origin by default). The optional parameter len
specifies the chord length.
Example
julia> w = naca4(0.0,0.0,0.12);
julia> p = Polygon(w);