Mesh
SemiAlgebraicTypes.Mesh
— TypeMesh{T}
Mesh corresponding to an array of points (Vector{T}
), an array of edges (Vector{Int64}
) and an array of faces (Vector{Int64}
).
Example
julia> mesh(Float64);
julia> mesh([[cos(i*pi/5), sin(i*pi/5), 0.0] for i in 1:10], Edge[], [[1,i,i+1] for i in 1:9]);
Fields:
points ::Matrix{T}
: array of pointsedges ::Vector{Vector{Int64}}
: array of edgesfaces ::Vector{Vector{Int64}}
: array of facesnormals ::Matrix{T}
: array of normalsattr ::Dict{Symbol,Any}
: attributes
SemiAlgebraicTypes.hmesh
— Functionhmesh(P::AbstractArray{Float64,2}, F::Vector{Vector{Int64}},N::Matrix{Float64}; args...)
- P matrix of points
- F array of faces
- N (optional) matrix of normals
Build a HMesh from the array of points and array of faces
Accessors and modificators
SemiAlgebraicTypes.normal
— Functionnormal(m::Mesh{T}, i::Int64)
Normal at the ith point of the mesh m.
Warning: The normals may not be defined in a mesh.
SemiAlgebraicTypes.push_vertex!
— FunctionInsert a vertex at the end of the vertex array of a mesh.
julia> m = mesh(Float64,3);
julia> push_vertex!(m,[1.,2.,3.])
SemiAlgebraicTypes.Mesh{Float64}(Array{Float64,1}[[1.0, 2.0, 3.0]], Array{Int64,1}[], Array{Int64,1}[], Dict{Symbol,Any}())
SemiAlgebraicTypes.push_edge!
— FunctionInsert a new edge given by the array of indices of the points (numbering starting at 1) at the end of the edge array of the mesh.
julia> m = mesh(Float64);
julia> push_vertex!(m,point(0.,0.,0.)); push_vertex!(m,point(1.,0.,0.)); push_edge!(m,[1,2])
SemiAlgebraicTypes.Mesh{Float64}(Array{Float64,1}[[0.0, 0.0, 0.0], [1.0, 0.0, 0.0]], Array{Int64,1}[[1, 2]], Array{Int64,1}[], Dict{Symbol,Any}())
SemiAlgebraicTypes.push_face!
— FunctionInsert a new face with the array of indices of the points (numbering starting at 1) at the end of the face array.
julia> m = mesh(Float64);
julia> for i in 1:10 push_vertex!(m,[cos(i*pi/5), sin(i*pi/5), 0.0]) end;
julia> for i in 1:9 push_face!(m,[1,i,i+1]) end;
SemiAlgebraicTypes.split_edge!
— FunctionInsert the point of index p in the edge e and its opposite if it exists. A new edge is added in front of the edge e, as well as in front of its opposite, if it exists.
SemiAlgebraicTypes.split_face!
— FunctionSplit the face f by inserting the edge between the vertices v1 and v2. A new face is added at the end of the array of faces.
SemiAlgebraicTypes.cc_subdivide!
— Functioncc_subdivide!(msh::HMesh, n::Int64 = 1)
Catmull-Clark subdivision of a Half-Edge mesh.
The mesh msh
is replaced by the subdivided mesh, applying n times Catmull-Clark scheme.
SemiAlgebraicTypes.cc_subdivide
— Functioncc_subdivide(msh::HMesh, n::Int64 = 1)
Catmull-Clark subdivision of a Half-Edge mesh.
The mesh msh
is replaced by the subdivided mesh, applying n times Catmull-Clark scheme.
SemiAlgebraicTypes.subdivide_middle!
— Functionsubdivide_middle!(msh::HMesh)
Subdivide each face by inserting the middle of the edges and the middle of the faces.
SemiAlgebraicTypes.remove_doublon!
— Functionremove_doublon!(m::Mesh{Float64}, eps::Float64=1.e-3)
Replace duplicate points which are within distance eps by a single point.
The default value for eps is 1.e-3.
Warning: The normals are not taken into account.
Functions
SemiAlgebraicTypes.nbv
— Functionnbv(m)
Number of vertices of the mesh m
SemiAlgebraicTypes.nbe
— Functionnbe(m)
Number of edges of the mesh m
SemiAlgebraicTypes.nbf
— Functionnbf(m)
Number of faces of the mesh m
SemiAlgebraicTypes.point
— Functionpoint(m::Mesh{T}, i::Int64)
Point of index i in the mesh m, as a Vector{T}.
SemiAlgebraicTypes.edge
— Functionedge(m::Mesh{T}, i::Int64)
Edge of index i in the mesh m, as a Vector{Int64} containing the indices of the vertices of the edge.
SemiAlgebraicTypes.face
— Functionface(m::Mesh{T}, i::Int64)
Face of index i in the mesh m, as a Vector{Int64} containing the indices of the vertices on the face boundary.
SemiAlgebraicTypes.ccw_edges
— Functionccw_edges(m::HMesh)
Array of arrays E[i] of edges in Counter-Clock-Wise order, which are adjacent to the edge of index i, starting from the boundary edge if it exists.
Base.join
— Functionjoin(M::Mesh{Float64}...)
Join the meshes M1, M2, ... into a single mesh.
SemiAlgebraicTypes.face_orientation
— Functionface_orientation( m::Mesh{T} )
Compute a sequence of arrows starting at the barycenter of each face and pointing in the direction of the oriented normal to the face (cross product of 2 first edge vectors).
The size of the arrow is proportional to the sqrt of the area of the triangle formed by the 3 first points of the face.