Mesh

SemiAlgebraicTypes.MeshType
Mesh{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 points
  • edges ::Vector{Vector{Int64}}: array of edges
  • faces ::Vector{Vector{Int64}}: array of faces
  • normals ::Matrix{T}: array of normals
  • attr ::Dict{Symbol,Any}: attributes
source
SemiAlgebraicTypes.hmeshFunction
hmesh(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

source

Accessors and modificators

SemiAlgebraicTypes.normalFunction
normal(m::Mesh{T}, i::Int64)

Normal at the ith point of the mesh m.

Warning: The normals may not be defined in a mesh.

source
SemiAlgebraicTypes.push_vertex!Function

Insert 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}())
source
SemiAlgebraicTypes.push_edge!Function

Insert 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}())
source
SemiAlgebraicTypes.push_face!Function

Insert 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;
source
SemiAlgebraicTypes.split_edge!Function

Insert 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.

source
SemiAlgebraicTypes.cc_subdivide!Function
cc_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.

source
SemiAlgebraicTypes.cc_subdivideFunction
cc_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.

source
SemiAlgebraicTypes.remove_doublon!Function
remove_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.

source

Functions

SemiAlgebraicTypes.edgeFunction
edge(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.

source
SemiAlgebraicTypes.faceFunction
face(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.

source
SemiAlgebraicTypes.ccw_edgesFunction
ccw_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.

source
Base.joinFunction
join(M::Mesh{Float64}...)

Join the meshes M1, M2, ... into a single mesh.

source
SemiAlgebraicTypes.face_orientationFunction

face_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.

source