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
gsGeometry

Abstract 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/surfaces
  • TensorBSpline: Tensor product B-spline surfaces and volumes
  • Nurbs: Univariate and multivariate NURBS curves/surfaces
  • TensorNurbs: Tensor product NURBS surfaces and volumes

All geometry types support common operations such as evaluation, derivatives, closest point queries, and geometric refinement.

See Also

source

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 basis
  • coefs: 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)
source

Properties and Queries

These query functions are also available for basis functions. See the Basis Functions section for detailed documentation.

TinyGismo.basis — Function
basis(spline::BSpline)

Get the underlying B-spline basis.

Arguments

  • spline: The B-spline

Returns

The BSplineBasis used by the spline

source
TinyGismo.numCoefs — Function
numCoefs(spline::BSpline)

Get the number of control points.

Arguments

  • spline: The B-spline

Returns

The number of control points

source
TinyGismo.coefAtCorner — Function
coefAtCorner(geometry::gsGeometry, c::Int)

Get the control point at a specific corner.

Arguments

  • geometry: The geometry
  • c: The corner index

Returns

The control point coordinates at that corner

source

Refinement

Refinement operations are shared with basis functions. See the Basis Functions - Refinement section for detailed documentation.

Degree Operations

These degree operations are shared with basis functions. See the Basis Functions - Degree and Continuity Operations section for detailed documentation.

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 basis
  • coefs: Control point coefficients — one row per control point, one column per physical coordinate, ordered lexicographically with the first parametric direction running fastest
  • corner: A 4 × 3 matrix of three-dimensional corner points listed counterclockwise around the patch; the result is a surface with targetDim == 3. Four corners and two knot vectors describe a bivariate patch, so only TensorBSpline{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.

source

Properties and Queries

These query functions are also available for basis functions. See the Basis Functions section for detailed documentation.

Refinement

Refinement operations are shared with basis functions. See the Basis Functions - Refinement section for detailed documentation.

Degree Operations

These degree operations are shared with basis functions. See the Basis Functions - Degree and Continuity Operations section for detailed documentation.

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 basis
  • coefs: 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.

source

Properties and Queries

These query functions are also available for basis functions. See the Basis Functions section for detailed documentation.

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 basis
  • i: The control point index (1-indexed)

Returns

The weight value at control point i

source

Refinement

Refinement operations are shared with basis functions. See the Basis Functions - Refinement section for detailed documentation.

Degree Operations

These degree operations are shared with basis functions. See the Basis Functions - Degree and Continuity Operations section for detailed documentation.

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 basis
  • coefs: 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.

source

Properties and Queries

These query functions are also available for basis functions. See the Basis Functions section for detailed documentation.

Refinement

Refinement operations are shared with basis functions. See the Basis Functions - Refinement section for detailed documentation.

Degree Operations

These degree operations are shared with basis functions. See the Basis Functions - Degree and Continuity Operations section for detailed documentation.

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

source
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

source

Evaluation

These evaluation methods are shared with basis functions. See the Basis Functions - Evaluation section for detailed documentation.

  • eval! - Evaluate at parametric points (in-place)
  • _eval - Evaluate at parametric points

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 derivative
  • deriv2! - 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 geometry
  • pt: The query point
  • result: 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.

source
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 geometry
  • u: Parametric evaluation points
  • out: 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.

source
TinyGismo.jacobian — Function
jacobian(geometry::gsGeometry, u::Union{Vector{Float64}, Matrix{Float64}})

Evaluate the Jacobian matrix of the geometry.

Arguments

  • geometry: The geometry
  • u: Parametric evaluation points

Returns

The Jacobian matrix

source
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 geometry
  • u: Parametric evaluation points
  • out: 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.

source
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 geometry
  • u: Parametric evaluation points
  • coord: The coordinate component (1-indexed)

Returns

The Hessian matrix

source

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)

source
TinyGismo.coefDim — Function
coefDim(geometry::gsGeometry)

Get the dimension of the coefficient space.

Arguments

  • geometry: The geometry

Returns

The coefficient dimension

source
TinyGismo.geoDim — Function
geoDim(geometry::gsGeometry)

Get the geometric dimension (same as target dimension).

Arguments

  • geometry: The geometry

Returns

The geometric dimension

source
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.)

source

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.

source
TinyGismo.convertToBSpline — Function
convertToBSpline(spline) -> TensorBSpline

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

source

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.