diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 97377ae..d5d18a9 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-03T13:23:28","documenter_version":"1.3.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-03T14:07:10","documenter_version":"1.3.0"}} \ No newline at end of file diff --git a/dev/functions/index.html b/dev/functions/index.html index 51010a7..c1ccd95 100644 --- a/dev/functions/index.html +++ b/dev/functions/index.html @@ -1,4 +1,4 @@ -Functions · A Julia package for computational (bio)mechanics and computational design

Functions

comododir

Comodo.comododirFunction
comododir()

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.

source

slidercontrol

Comodo.slidercontrolFunction
slidercontrol(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.

source

elements2indices

Comodo.elements2indicesFunction
elements2indices(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.

source

gridpoints

Comodo.gridpointsFunction
gridpoints(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.

source

interp_biharmonic_spline

Comodo.interp_biharmonic_splineFunction
interp_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

David T. Sandwell, Biharmonic spline interpolation of GEOS-3 and SEASAT altimeter data, Geophysical Research Letters, 2, 139-142, 1987. doi: 10.1029/GL014i002p00139

source

interp_biharmonic

nbezier

Comodo.nbezierFunction
nbezier(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}.

source

loflinear

Comodo.loftlinearFunction
loftlinear(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-vector
  • V2::Vector: n-vector
source

ray_triangle_intersect

Comodo.ray_triangle_intersectFunction
ray_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

Möller, Tomas; Trumbore, Ben (1997). "Fast, Minimum Storage Ray-Triangle Intersection". Journal of Graphics Tools. 2: 21-28. doi: 10.1080/10867651.1997.10487468.

source

mesh_curvature_polynomial

Comodo.mesh_curvature_polynomialFunction
mesh_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

F. Cazals and M. Pouget, "Estimating differential quantities using polynomial fitting of osculating jets", Computer Aided Geometric Design, vol. 22, no. 2, pp. 121-146, Feb. 2005, doi: 10.1016/j.cagd.2004.09.004

source

smoothmesh_hc

smoothmesh_laplacian

Comodo.smoothmesh_laplacianFunction
smoothmesh_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.

source

platonicsolid

Comodo.platonicsolidFunction
platonicsolid(n,r=1.0)

Description

Creates a GeometryBasics mesh description for a platonic solid of choice. The input n defines the choice.

  1. tetrahedron
  2. cube
  3. octahedron
  4. icosahedron
  5. 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

source

sub2ind

Comodo.sub2indFunction
sub2ind(siz,A)

Description

Converts the subscript indices in A, for a matrix/array with size siz, to the equivalent linear indices.

source

ind2sub

Comodo.ind2subFunction
ind2sub(siz,ind)

Description

Converts the linear indices in ind, for a matrix/array with size siz, to the equivalent subscript indices.

source
+Functions · A Julia package for computational (bio)mechanics and computational design

Functions

comododir

Comodo.comododirFunction
comododir()

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.

source

slidercontrol

Comodo.slidercontrolFunction
slidercontrol(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.

source

elements2indices

Comodo.elements2indicesFunction
elements2indices(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.

source

gridpoints

Comodo.gridpointsFunction
gridpoints(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.

source

interp_biharmonic_spline

Comodo.interp_biharmonic_splineFunction
interp_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

David T. Sandwell, Biharmonic spline interpolation of GEOS-3 and SEASAT altimeter data, Geophysical Research Letters, 2, 139-142, 1987. doi: 10.1029/GL014i002p00139

source

interp_biharmonic

nbezier

Comodo.nbezierFunction
nbezier(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}.

source

loflinear

Comodo.loftlinearFunction
loftlinear(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-vector
  • V2::Vector: n-vector
source

ray_triangle_intersect

Comodo.ray_triangle_intersectFunction
ray_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

Möller, Tomas; Trumbore, Ben (1997). "Fast, Minimum Storage Ray-Triangle Intersection". Journal of Graphics Tools. 2: 21-28. doi: 10.1080/10867651.1997.10487468.

source

mesh_curvature_polynomial

Comodo.mesh_curvature_polynomialFunction
mesh_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

F. Cazals and M. Pouget, "Estimating differential quantities using polynomial fitting of osculating jets", Computer Aided Geometric Design, vol. 22, no. 2, pp. 121-146, Feb. 2005, doi: 10.1016/j.cagd.2004.09.004

source

smoothmesh_hc

smoothmesh_laplacian

Comodo.smoothmesh_laplacianFunction
smoothmesh_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.

source

platonicsolid

Comodo.platonicsolidFunction
platonicsolid(n,r=1.0)

Description

Creates a GeometryBasics mesh description for a platonic solid of choice. The input n defines the choice.

  1. tetrahedron
  2. cube
  3. octahedron
  4. icosahedron
  5. 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

source

sub2ind

Comodo.sub2indFunction
sub2ind(siz,A)

Description

Converts the subscript indices in A, for a matrix/array with size siz, to the equivalent linear indices.

source

ind2sub

Comodo.ind2subFunction
ind2sub(siz,ind)

Description

Converts the linear indices in ind, for a matrix/array with size siz, to the equivalent subscript indices.

source
diff --git a/dev/index.html b/dev/index.html index d51cf77..9b2fd89 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Comodo.jl · A Julia package for computational (bio)mechanics and computational design
+Comodo.jl · A Julia package for computational (bio)mechanics and computational design