Functions
comododir
Comodo.comododir
— Functioncomododir()
Description
This function simply returns the string for the Comodo path. This is helpful for instance to load items, such as meshes, from the assets
` folder.
slidercontrol
Comodo.slidercontrol
— Functionslidercontrol(hSlider,ax)
Description
This function adds arrow key control to GLMakie sliders. The inputs are the slider handle hSlider
as well as the axis ax
. If this function is called the slider can be advanced a step by pressing the right arrow, and returned one step by pressing the left arrow. When one presses and holds the right or left arrow key, the slider will continue to move (as fast as graphics updating is possible on your system) up to the end or start slider position respectively. Users may also use the up or down arrow keys. These function the same as the right and left arrow keys, however, rather than stopping at the slider extrema, the sliders position will "wrap" back to the start when advancing beyond the end position, and vice versa.
elements2indices
Comodo.elements2indices
— Functionelements2indices(F)
Description
This function obtains the unique set of indices for the vertices (nodes) used by the the simplices defined by F
. The vector F
may contain any type of simplices. For instance the elements in F
may be of the type GeometryBasics.TriangleFace
or GeometryBasics.QuadFace
(or any other) for surface mesh data. However, volumetric elements of any type are permitted. In essence this function simply returns unique(reduce(vcat,F))
. Hence any suitable vector containing vectors of numbers permitted by reduce(vcat,F)
is supported.
gridpoints
Comodo.gridpoints
— Functiongridpoints(x::Vector{T}, y=x, z=x) where T<:Real
Description
The gridpoints
function returns a vector of 3D points which span a grid in 3D space. Points are defined as per the input ranges or range vectors. The output point vector contains elements of the type GeometryBasics.Point3
.
interp_biharmonic_spline
Comodo.interp_biharmonic_spline
— Functioninterp_biharmonic_spline(x::Union{Vector{T}, AbstractRange{T}},y::Union{Vector{T}, AbstractRange{T}},xi::Union{Vector{T}, AbstractRange{T}}; extrapolate_method=:linear,pad_data=:linear) where T<:Real
Description
This function uses biharmonic spline interpolation, which features radial basis functions. The input is assumed to represent ordered data, i.e. consequtive unique points on a curve. The curve x-, and y-coordinates are provided through the input parameters x
and y
respectively. The third input xi
defines the sites at which to interpolate. Each of in the input parameters can be either a vector or a range.
References
interp_biharmonic
Comodo.interp_biharmonic
— Functioninterp_biharmonic(x,y,xi)
Description
This function uses biharmonic interpolation. The input x
should define a vector consisting of m points which are n-dimensional, and the input y
should be a vector consisting of m scalar data values.
References
nbezier
Comodo.nbezier
— Functionnbezier(P,n)
Description
This function returns n
points for an m-th order Bézier spline, based on the m control points contained in the input vector P
. This function supports point vectors with elements of the type AbstractPoint{3}
(e.g. GeometryBasics.Point{3, Float64}
) or Vector{Float64}
.
loflinear
Comodo.loftlinear
— Functionloftlinear(V1,V2;num_steps=2,close_loop=true,face_type=:tri)
Loft a surface mesh between two input curves
Description
The loftlinear
function spans a surface from input curve V1
to curve V2
. The surface is formed by "lerping" curves from V1
to V2
in num_loft
steps, and forming mesh faces between each curve. If close_loop==true
then it is assumed the curves (and therefore the output surface mesh should be closed over, i.e. that a connection should be made between each curve end and start point. The user can request different face types for the output. The default is face_type=:tri
which will form isoceles triangles (or equilateral triangles if the spacing is even) for a planar curve. The other face_type
options supported are :quad
(quadrilateral), and :tri_slash
. For the latter, triangles are formed by slashing the quads.
Arguments:
V1::Vector
: n-vectorV2::Vector
: n-vector
ray_triangle_intersect
Comodo.ray_triangle_intersect
— Functionray_triangle_intersect(F::Vector{TriangleFace{Int64}},V,ray_origin,ray_vector; rayType = :ray, triSide = 1, tolEps = eps(Float64))
-ray_triangle_intersect(f::TriangleFace{Int64},V,ray_origin,ray_vector; rayType = :ray, triSide = 1, tolEps = eps(Float64))
Description
This function can compute triangle-ray or triangle-line intersections through the use of the "Möller-Trumbore triangle-ray intersection algorithm". The required inputs are as follows:
F
an single face or a vector of faces, e.g. Vector{TriangleFace{Int64}}
V
The triangle vertices as a vector of points, i.e. Vector{GeometryBasics.Point{3, Float64}}
ray_vector
The ray vector which can be Vector{GeometryBasics.Point{3, Float64}}
or Vec3{Float64}
The following optional input parameters can be provided: rayType = :ray
(default) or :line
. This defines wether the vector is treated as a ray (extends indefinately) or as a line (finite length) triSide = 1
(default) or 0
or -1
. When triSide=1
only the inward intersections are considered, e.g. when the ray or line enters the shape (ray/line is pointing against face normal) When triSide=-1
only the outward intersections are considered, e.g. when the ray or line exits the shape (ray/line is pointing allong face normal) When triSide=0
both inward and outward intersections are considered. tolEps = eps(Float64)
(default)
References
mesh_curvature_polynomial
Comodo.mesh_curvature_polynomial
— Functionmesh_curvature_polynomial(F::Vector{TriangleFace{Int64}},V::Vector{Point3{Float64}})
-mesh_curvature_polynomial(M::GeometryBasics.Mesh)
Description
This function computes the mesh curvature at each vertex for the input mesh defined by the face F
and the vertices V
. A local polynomial is fitted to each point's "Laplacian umbrella" (point neighbourhood), and the curvature of this fitted form is derived. Instead of the mesh faces and vertices one may instead specify the GeometryBasics.Mesh
M
as the input.
The reference below provides more detail on the algorithm. In addition, this implementation was created with the help of this helpful document, which features a nice overview of the theory/steps involved in this algorithm.
References
smoothmesh_hc
Comodo.smoothmesh_hc
— Functionsmoothmesh_hc(F,V, con_V2V=nothing; n=1, α=0.1, β=0.5, tolDist=nothing)
Description
This function implements HC (Humphrey's Classes) smoothing. This method uses Laplacian like smoothing but aims to compensate for shrinkage/swelling by also "pushing back" towards the original coordinates.
Reference
smoothmesh_laplacian
Comodo.smoothmesh_laplacian
— Functionsmoothmesh_laplacian(F,V,con_V2V=nothing; n=1, λ=0.5)
Description
This function implements weighted Laplacian mesh smoothing. At each iteration, this method replaces each point by an updated coordinate based on the mean coordinates of that point's Laplacian umbrella. The update features a lerp like weighting between the previous iterations coordinates and the mean coordinates. The code features Vs[q] = (1.0-λ).*Vs[q] .+ λ*mean(V[con_V2V[q]])
As can be seen, the weighting is controlled by the input parameter λ
which is in the range (0,1). If λ=0
then no smoothing occurs. If λ=1
then pure Laplacian mean based smoothing occurs. For intermediate values a linear blending between the two occurs.
platonicsolid
Comodo.platonicsolid
— Functionplatonicsolid(n,r=1.0)
Description
Creates a GeometryBasics mesh description for a platonic solid of choice. The input n
defines the choice.
- tetrahedron
- cube
- octahedron
- icosahedron
- dodecahedron
The final input parameter r
defines the radius of the platonic solid (the radius of the circumsphere to the vertices).
Arguments
n::Integer, defining platonic solid type r::Float64, defining circumsphere radius
sub2ind
Comodo.sub2ind
— Functionsub2ind(siz,A)
Description
Converts the subscript indices in A
, for a matrix/array with size siz
, to the equivalent linear indices.
ind2sub
Comodo.ind2sub
— Functionind2sub(siz,ind)
Description
Converts the linear indices in ind
, for a matrix/array with size siz
, to the equivalent subscript indices.