Geometries
Geometric objects represent spline curves, surfaces, and volumes. All geometry types inherit from gsGeometry and support evaluation, derivatives, and various geometric queries.
Base Types
TinyGismo.gsGeometry — Type
gsGeometryAbstract base type for all geometry types in TinyGismo.
Details
gsGeometry is the parent type for all geometric objects, including:
BSpline: Univariate and multivariate B-spline curves/surfacesTensorBSpline: Tensor product B-spline surfaces and volumesNurbs: Univariate and multivariate NURBS curves/surfacesTensorNurbs: Tensor product NURBS surfaces and volumes
All geometry types support common operations such as evaluation, derivatives, closest point queries, and geometric refinement.
See Also
B-Spline Geometries
Univariate B-Splines
TinyGismo.BSpline — Type
BSpline(basis::BSplineBasis, coefs::Union{Vector{Float64}, Matrix{Float64}})Construct a B-spline curve or surface from a basis and control points.
Arguments
basis: The B-spline basiscoefs: Control point coefficients (vector for curves, matrix for surfaces)
Returns
A BSpline object
Details
A B-spline is defined by a basis and control points. The basis determines the spline space, and the control points define the actual geometry.
Examples
basis = BSplineBasis(kv)coefs = [1.0, 2.0, 3.0, 4.0]spline = BSpline(basis, coefs)Properties and Queries
These query functions are also available for basis functions. See the Basis Functions section for detailed documentation.
TinyGismo.knots- Get the knot vectorTinyGismo.degree- Get the polynomial degreeTinyGismo.basis- Get the underlying basisboundary- Extract a boundary curve/surface
TinyGismo.basis — Function
basis(spline::BSpline)Get the underlying B-spline basis.
Arguments
spline: The B-spline
Returns
The BSplineBasis used by the spline
TinyGismo.numCoefs — Function
numCoefs(spline::BSpline)Get the number of control points.
Arguments
spline: The B-spline
Returns
The number of control points
TinyGismo.coefAtCorner — Function
coefAtCorner(geometry::gsGeometry, c::Int)Get the control point at a specific corner.
Arguments
geometry: The geometryc: The corner index
Returns
The control point coordinates at that corner
Refinement
Refinement operations are shared with basis functions. See the Basis Functions - Refinement section for detailed documentation.
insertKnot!- Insert a knot into the geometryuniformRefine!- Uniformly refine the meshuniformCoarsen!- Uniformly coarsen the mesh
Degree Operations
These degree operations are shared with basis functions. See the Basis Functions - Degree and Continuity Operations section for detailed documentation.
degreeElevate!- Elevate the polynomial degreedegreeReduce!- Reduce the polynomial degreedegreeIncrease!- Increase the polynomial degreedegreeDecrease!- Decrease the polynomial degree
Tensor Product B-Splines
TinyGismo.TensorBSpline — Type
TensorBSpline{1}(basis::BSplineBasis{1}, coefs::Union{Vector{Float64}, Matrix{Float64}})
TensorBSpline{2}(basis::TensorBSplineBasis{2}, coefs::Matrix{Float64})
TensorBSpline{3}(basis::TensorBSplineBasis{3}, coefs::Matrix{Float64})
TensorBSpline{2}(corner::Matrix{Float64}, kv1::KnotVector, kv2::KnotVector)Construct a tensor product B-spline surface or volume.
Arguments
basis: The tensor product B-spline basiscoefs: Control point coefficients — one row per control point, one column per physical coordinate, ordered lexicographically with the first parametric direction running fastestcorner: A4 × 3matrix of three-dimensional corner points listed counterclockwise around the patch; the result is a surface withtargetDim == 3. Four corners and two knot vectors describe a bivariate patch, so onlyTensorBSpline{2}is meaningful here — the method is registered for the other dimensions too, but{1}silently builds nonsense and{3}segfaults.kv1,kv2: Knot vectors for each parametric direction
Returns
A TensorBSpline object (surface or volume)
Details
Tensor product B-splines are formed by taking the tensor product of univariate B-spline bases. They are parameterized by 2 or more parameters and are commonly used for representing surfaces and volumes.
All methods from gsGeometry are available for TensorBSpline objects.
Examples
kv1 = KnotVector([0.0, 0.0, 0.0, 1.0, 1.0, 1.0]) # 3 functionskv2 = KnotVector([0.0, 0.0, 1.0, 1.0]) # 2 functionscoefs = [0.0 0.0; 0.5 0.4; 1.0 0.0; 0.0 1.0; 0.5 1.4; 1.0 1.0]basis = TensorBSplineBasis{2}(kv1, kv2)surface = TensorBSpline{2}(basis, coefs)Note
There are further overloads taking the knot vectors directly, such as TensorBSpline{2}(kv1, kv2, coefs); those expect coefs as a gsMatrix, which you fill with TinyGismo.setValue!. The (basis, coefs) form is usually easier, since it accepts a plain Julia matrix.
Properties and Queries
These query functions are also available for basis functions. See the Basis Functions section for detailed documentation.
TinyGismo.knots- Get the knot vectorTinyGismo.degree- Get the polynomial degreeTinyGismo.basis- Get the underlying basisTinyGismo.boundary- Extract a boundary curve/surface
Refinement
Refinement operations are shared with basis functions. See the Basis Functions - Refinement section for detailed documentation.
insertKnot!- Insert a knot into the geometryuniformRefine!- Uniformly refine the meshuniformCoarsen!- Uniformly coarsen the mesh
Degree Operations
These degree operations are shared with basis functions. See the Basis Functions - Degree and Continuity Operations section for detailed documentation.
degreeElevate!- Elevate the polynomial degreedegreeReduce!- Reduce the polynomial degreedegreeIncrease!- Increase the polynomial degreedegreeDecrease!- Decrease the polynomial degree
NURBS Geometries
Univariate NURBS
TinyGismo.Nurbs — Type
Nurbs(basis::NurbsBasis, coefs::Union{Vector{Float64}, Matrix{Float64}})Construct a NURBS curve from a NURBS basis and control points.
Arguments
basis: The NURBS basiscoefs: Control point coefficients (vector for curves, matrix for surfaces)
Returns
A Nurbs object
Details
A NURBS (Non-Uniform Rational B-Spline) curve or surface is defined by a NURBS basis (which includes weights) and control points. The rational nature allows exact representation of conic sections and provides local control through weights.
Examples
kv = KnotVector([0.0, 0.0, 0.0, 1.0, 1.0, 1.0])weights = [1.0, sqrt(2)/2, 1.0]basis = NurbsBasis(kv, weights)coefs = [1.0 0.0; 1.0 1.0; 0.0 1.0]curve = Nurbs(basis, coefs)All methods from gsGeometry are available for Nurbs objects.
Properties and Queries
These query functions are also available for basis functions. See the Basis Functions section for detailed documentation.
TinyGismo.knots- Get the knot vectorTinyGismo.degree- Get the polynomial degreeTinyGismo.basis- Get the underlying basisTinyGismo.boundary- Extract a boundary curve/surfaceTinyGismo.weights- Get the control point weights
TinyGismo.weight — Function
weight(nurbs::Nurbs, i::Int)
weight(basis::Union{NurbsBasis, TensorNurbsBasis}, i::Int)Get the weight of a specific control point, i.e. of basis function i.
On a tensor product geometry there is no weight; index into TinyGismo.weights or use the method of its basis instead.
Arguments
nurbs/basis: The NURBS curve or NURBS basisi: The control point index (1-indexed)
Returns
The weight value at control point i
Refinement
Refinement operations are shared with basis functions. See the Basis Functions - Refinement section for detailed documentation.
insertKnot!- Insert a knot into the geometryuniformRefine!- Uniformly refine the meshuniformCoarsen!- Uniformly coarsen the mesh
Degree Operations
These degree operations are shared with basis functions. See the Basis Functions - Degree and Continuity Operations section for detailed documentation.
degreeElevate!- Elevate the polynomial degreedegreeReduce!- Reduce the polynomial degreedegreeIncrease!- Increase the polynomial degreedegreeDecrease!- Decrease the polynomial degree
Tensor Product NURBS
TinyGismo.TensorNurbs — Type
TensorNurbs{2}(basis::TensorNurbsBasis{2}, coefs::Matrix{Float64})
TensorNurbs{3}(basis::TensorNurbsBasis{3}, coefs::Matrix{Float64})Construct a tensor product NURBS surface or volume from a basis and control points.
Arguments
basis: The tensor product NURBS basiscoefs: Control point coefficients — one row per control point, one column per physical coordinate, ordered lexicographically with the first parametric direction running fastest
Returns
A TensorNurbs object (surface or volume)
Details
Tensor product NURBS surfaces and volumes are formed by taking the tensor product of univariate NURBS bases. They combine the flexibility of tensor products with the rational properties of NURBS, enabling exact representation of complex shapes including quadric surfaces.
All methods from gsGeometry are available for TensorNurbs objects.
Examples
kv1 = KnotVector([0.0, 0.0, 0.0, 1.0, 1.0, 1.0]) # 3 functionskv2 = KnotVector([0.0, 0.0, 1.0, 1.0]) # 2 functionsweights = reshape([1.0, sqrt(2)/2, 1.0, 1.0, sqrt(2)/2, 1.0], 6, 1)basis = TensorNurbsBasis{2}(kv1, kv2, weights)coefs = [1.0 0.0; 2.0 0.0; 1.0 1.0; 2.0 2.0; 0.0 1.0; 0.0 2.0]surface = TensorNurbs{2}(basis, coefs)Note
As for TensorBSpline, the overloads taking knot vectors directly expect coefs as a gsMatrix; the (basis, coefs) form accepts a plain Julia matrix.
Properties and Queries
These query functions are also available for basis functions. See the Basis Functions section for detailed documentation.
TinyGismo.knots- Get the knot vectorTinyGismo.degree- Get the polynomial degreeTinyGismo.basis- Get the underlying basisTinyGismo.boundary- Extract a boundary curve/surfaceTinyGismo.weights- Get the control point weights
Refinement
Refinement operations are shared with basis functions. See the Basis Functions - Refinement section for detailed documentation.
insertKnot!- Insert a knot into the geometryuniformRefine!- Uniformly refine the meshuniformCoarsen!- Uniformly coarsen the mesh
Degree Operations
These degree operations are shared with basis functions. See the Basis Functions - Degree and Continuity Operations section for detailed documentation.
degreeElevate!- Elevate the polynomial degreedegreeReduce!- Reduce the polynomial degreedegreeIncrease!- Increase the polynomial degreedegreeDecrease!- Decrease the polynomial degree
Generic Geometry Operations
These methods work on all geometry types (B-spline and NURBS).
Control Points
TinyGismo.coefsSize — Function
coefsSize(geometry::gsGeometry)Get the size (number of control points).
Arguments
geometry: The geometry
Returns
The number of control points
TinyGismo.coefs — Function
coefs(geometry::gsGeometry)Get the control points (coefficients) of the geometry.
Arguments
geometry: The geometry
Returns
A matrix of control point coordinates
Evaluation
These evaluation methods are shared with basis functions. See the Basis Functions - Evaluation section for detailed documentation.
Derivatives
These derivative methods are shared with basis functions. See the Basis Functions - Derivatives section for detailed documentation.
deriv!- First derivative (in-place)deriv- First derivativederiv2!- Second derivative (in-place)deriv2- Second derivative
Geometric Queries
TinyGismo.closestPointTo — Function
closestPointTo(geometry::gsGeometry, pt::Vector{Float64}, result::gsVector{Float64})Find the closest point on the geometry to a given point.
Arguments
geometry: The geometrypt: The query pointresult: Output gsVector{Float64} to store the closest parametric point (modified in-place)
Details
Computes the closest point on the geometry to the given point and returns its parametric coordinates in result.
TinyGismo.jacobian! — Function
jacobian!(geometry::gsGeometry, u::Union{Vector{Float64}, Matrix{Float64}}, out::gsMatrix{Float64})Evaluate the Jacobian matrix of the geometry (in-place).
Arguments
geometry: The geometryu: Parametric evaluation pointsout: Output gsMatrix{Float64} to store Jacobian (modified in-place)
Details
The Jacobian is the matrix of all first-order partial derivatives of the geometry mapping.
TinyGismo.jacobian — Function
jacobian(geometry::gsGeometry, u::Union{Vector{Float64}, Matrix{Float64}})Evaluate the Jacobian matrix of the geometry.
Arguments
geometry: The geometryu: Parametric evaluation points
Returns
The Jacobian matrix
TinyGismo.hessian! — Function
hessian!(geometry::gsGeometry, u::Union{Vector{Float64}, Matrix{Float64}}, out::gsMatrix{Float64}, coord::Int)Evaluate the Hessian matrix of a coordinate function (in-place).
Arguments
geometry: The geometryu: Parametric evaluation pointsout: Output gsMatrix{Float64} to store Hessian (modified in-place)coord: The coordinate component (1-indexed)
Details
The Hessian is the matrix of second-order partial derivatives for the specified coordinate.
TinyGismo.hessian — Function
hessian(geometry::gsGeometry, u::Union{Vector{Float64}, Matrix{Float64}}, coord::Int)Evaluate the Hessian matrix of a coordinate function.
Arguments
geometry: The geometryu: Parametric evaluation pointscoord: The coordinate component (1-indexed)
Returns
The Hessian matrix
Dimension Queries
TinyGismo.targetDim — Function
targetDim(geometry::gsGeometry)Get the dimension of the ambient space (target dimension).
Arguments
geometry: The geometry
Returns
The target dimension (physical space dimension)
TinyGismo.coefDim — Function
coefDim(geometry::gsGeometry)Get the dimension of the coefficient space.
Arguments
geometry: The geometry
Returns
The coefficient dimension
TinyGismo.geoDim — Function
geoDim(geometry::gsGeometry)Get the geometric dimension (same as target dimension).
Arguments
geometry: The geometry
Returns
The geometric dimension
TinyGismo.parDim — Function
parDim(geometry::gsGeometry)Get the parametric dimension (number of parameters).
Arguments
geometry: The geometry
Returns
The parametric dimension (1 for curves, 2 for surfaces, etc.)
Hierarchical Geometries
Geometries spanned by a hierarchical basis, so that they can be refined locally. See Hierarchical Bases for the bases themselves.
TinyGismo.THBSpline — Type
THBSpline{d}(basis::THBSplineBasis{d}, coefs::Matrix{Float64})
THBSpline{d}(tensorSpline::TensorBSpline{d})A geometry spanned by a truncated hierarchical B-spline basis.
coefs has one row per basis function and one column per target coordinate. The second form lifts a tensor B-spline geometry unchanged, so that it can then be refined locally.
refineElements! changes the representation but not the map: the control points are carried along exactly.
See also HBSpline, convertToBSpline.
TinyGismo.HBSpline — Type
HBSpline{d}(basis::HBSplineBasis{d}, coefs::Matrix{Float64})
HBSpline{d}(tensorSpline::TensorBSpline{d})A geometry spanned by an untruncated hierarchical B-spline basis. The counterpart of THBSpline for HBSplineBasis.
TinyGismo.convertToBSpline — Function
convertToBSpline(spline) -> TensorBSplineRefine a hierarchical geometry over its whole domain to its finest level and return the equivalent tensor B-spline geometry.
The result describes the same map, and is generally far larger than the hierarchical representation — that size difference being the point of hierarchical refinement. Meant for export and interoperability rather than computation.
Refinement
Refining a hierarchical geometry carries the control points along, so the geometry is unchanged as a map — only its representation gets finer. The box conventions are those of RefinementBox.
refineElements!- Refine over an exactly specified set of elementsunrefineElements!- Coarsen over an exactly specified set of elementsuniformRefine!- Uniformly refine the mesh