-
Notifications
You must be signed in to change notification settings - Fork 39
Module Geometry
The following image shows a simplified overview of the hierarchy of the main geometry classes in GoTools.
All geometric objects are of type GeomObject
. This class has a function instanceType
, and by calling this function, it is possible to check the concrete type of a given object. A GeomObject is Streamable
, which means that they can be written to and read from a stream (typically a file) in a uniform way. See the GoTools g2-file format documentation for more information on this topic. Similarly, they can be created in a uniform way by the Factory
, which is useful when you want to generate objects whose exact kind is unknown at compile time.
ParamCurve
is the base class for all parametric curves in GoTools and defines a common interface. Many operations do not need to distinguish between different types of parametric curves. A parametric curve has (with some exceptions) the following functionality:
- operations on the curve
-
clone
: make a copy of this curve -
subCurve
: create a subcurve of this curve -
appendCurve
: append another curve to this curve -
split
: split the curve into two curves at a given parameter
-
- operations in the parameter interval
-
startparam
: fetch start parameter -
endparam
: fetch end parameter -
setParameterInterval
: linearly reparametrize the parameter interval -
reverseParameterDirection
: reverse the parameter interval
-
- evaluations
-
point
: evaluate the curve's position (and perhaps a certain number of derivatives) at a given parameter -
uniformEvaluator
: evaluate the curve's position at a regular set of parameter values
-
- geometric information retrieval
-
length
: compute the length of (a segment of) the curve -
estimatedCurveLength
: estimate the length of (a segment of) the curve -
compositeBox
: compute a composite box (bounding box) enclosing the curve -
directionCone
: compute a directional cone containing all tangent directions of this curve
-
- closest point computations
-
closestPointGeneric
: compute the closest point on (a segment of) this curve to a specified point --- generic implementation -
closestPoint
: compute the closest point on (a segment of) this curve to a specified point --- specific implementation for each parametric curve type
-
- checks for degeneracy, symmetry, and type
-
isLinear
: check if the curve is linear -
isInPlane
: check if the curve is contained in a plane belonging to a given pencil of planes -
isAxisRotational
: check if the curve is axis rotational -
isDegenerate
: check whether the curve degenerates to a single point -
isClosed
: check whether the curve is closed
-
ParamSurface
is the base class for a parametric surface and defines the
common interface for all parametric surfaces. A parametric surface has (with some exceptions) the following functionality:
- operations on the surface
-
clone
: make a copy of this surface -
subSurfaces
: create subsurfaces of this surface -
asSplineSurface
: create a spline surface represented by this surface, if any -
outerBoundaryLoop
: fetch the anticlockwise, outer boundary loop of the surface -
allBoundaryLoops
: fetch the anticlockwise outer boundary loop of the surface, together with clockwise loops of any interior boundaries -
getBoundaryInfo
: compute the boundary curve segment between two points on the boundary, as well as the cross-tangent curve -
mirrorSurface
: reflect the surface through a given plane -
getInternalPoint
: fetch an (unspecified) internal point in the surface -
constParamCurves
: fetch the curve(s) obtained by intersecting the surface with one of its isoparametric curves -
nextSegmentVal
: determine the parameter value of the start of the 'next segment' from a parameter value, along a given parameter direction -
turnOrientation
: flip the direction of the normal of the surface -
getCornerPoints
: fetch surface corners, geometric and parametric points
-
- operations in the parameter domain
-
setParameterDomain
: set the parameter domain to a given rectangle -
parameterDomain
: fetch the parameter domain -
containingDomain
: fetch a rectangular domain that contains the parameter domain -
inDomain
: check if a parameter pair lies in the parameter domain -
inDomain2
: check if a parameter pair lies inside, on the boundary, or outside of the parameter domain -
onBoundary
: check if a parameter pair lies on the boundary of the parameter domain -
closestInDomain
: fetch the parameter value in the parameter domain closest to a given parameter pair -
reverseParameterDirection
: reverse one of the parameter directions -
swapParameterDirection
: swap the two parameter directions
-
- geometric information retrieval
-
normalCone
: create a direction cone containing all surface normals -
tangentCone
: create a direction cone containing all surface tangents in a given parameter direction -
compositeBox
: compute a composite box (bounding box) enclosing the surface -
area
: compute the total area of this surface -
estimateSfSize
: estimate the size of the surface in the two parameter directions
-
- evaluations
-
point
: evaluate the surface's position (and perhaps a certain number of derivatives) at a given parameter pair -
normal
: evaluate the surface normal for a given parameter pair -
evalGrid
: evaluate the surface's position at a grid in the parameter domain
-
- closest point computations
-
closestPoint
: iteratively find the closest point on the surface to a given point -
closestBoundaryPoint
: iteratively find the closest point on the boundary of the surface to a given point -
setIterator
: set type of closest point iterator
-
- checks for degeneracy, symmetry, and type
-
isDegenerate
: check whether one of the four boundary curves is degenerate (i.e., has zero length) -
getDegenerateCorners
: find degenerate surface corners by checking for parallel and anti-parallel partial derivatives -
isIsoTrimmed
: check if the surface is trimmed along constant parameter curves -
isSpline
: check if the surface is of type spline -
isAxisRotational
: check if the surface is axis rotational -
isPlanar
: check if the surface is planar -
isLinear
: check if the surface is linear in one or both directions -
ElementOnBoundary
: check if a polynomial element (for spline surfaces) intersects the (trimming) boundaries -
ElementBoundaryStatus
: check if a polynomial element (for spline surfaces) intersects the (trimming) boundaries, is inside or outside
-
A B-spline curve is represented by the SplineCurve
class.
Mathematically, the curve is defined by the parametrization
The dimension
A B-spline curve is a linear combination of a sequence of
B-splines
The parameter range of a B-spline curve
The complete representation of a B-spline curve consists of
-
$dim$ : The dimension of the underlying Euclidean space,$1,2,3,\ldots$ . -
$n$ : The number of control points (also the number of B-splines) -
$k$ : The order (polynomial degree + 1) of the B-splines. -
${\bf t}$ : The knot vector of the B-splines.${\bf t} = (t_1, t_2, \ldots, t_{n+k})$ . -
${\bf p}$ : The control points of the B-spline curve.$p_{d,i}, d=1,\ldots,dim, i=1,\ldots,n.$ E.g. when$dim = 3$ , we have${\bf p} = (x_1,y_1,z_1,x_2,y_2,z_2,\ldots,x_n,y_n,z_n)$ .
We note that arrays in
The data in the curve representation must satisfy certain conditions:
- The knot vector must be non-decreasing:
$t_i \le t_{i+1}$ . Moreover, the knots$t_i$ and$t_{i+k}$ must be distinct:$t_i < t_{i+k}$ . - The number of control points should be greater than or equal
to the order of the curve:
$n \ge k$ .
To understand the representation better, we will look at three parts of the representation: the B-splines (the basis functions), the knot vector and the control polygon.
The spline space is represented by the class BsplineBasis
.
A set of B-spline basis functions is determined by the order
For example, to define a single basis function of degree one, we need three knots.
A linear B-spline (order 2) defined by three knots
In the figure the three knots are marked as dots.
Linear B-splines with multiple knots at one end
In the figure above the two knots at each end are equal.
By taking a linear combination of the three basis functions shown above, we can generate a linear spline function as shown in the next figure.
A linear B-spline curve of dimension 1 (solid) as a linear combination of a sequence of B-splines. Each B-spline (dashed) is scaled by a coefficient.
A quadratic B-spline basis function is a linear combination of two linear
basis functions, in which the coefficients are linear affine in the parameter
A quadratic B-spline (solid) as a weighted (dashed) linear combination of linear B-splines (solid)
For higher-order B-splines there is a similar definition.
A B-spline of order
and then the B-splines of order
B-spline basis functions satisfy some important properties for curve and surface design. Each basis function is non-negative and it can be shown that they sum to one,
These properties combined mean that B-spline curves
satisfy the convex hull property: the curve lies in the convex
hull of its control points.
Furthermore, the support of the B-spline basis function
With
The control polygon of a B-spline curve is the polygonal
arc formed by its control points,
Linear, quadratic, and cubic planar B-spline curves sharing the same control polygon
Another property of the control polygon is that it will get closer to the curve if it is redefined by inserting knots into the curve and thereby increasing the number of control points. This can be seen in the next figure. In the limit, the refinement of the control polygon converges to its B-spline curve.
The cubic B-spline curve shown above with a redefined knot vector
The knots of a B-spline curve describe the following properties of the curve:
- The parameterization of the B-spline curve
- The continuity at the joins between the adjacent polynomial segments of the B-spline curve.
Although the curves in the figure below have the same control polygon, they have different knot vectors and therefore different parametrizations.
Two quadratic planar B-spline curves with identical control polygons but different knot vectors
This example is not meant as an encouragement to use parameterization for modelling, rather to make users aware of the effect of parameterization. Something close to curve length parameterization is in most cases preferable. For interpolation, chord-length parameterization is used in most cases.
The number of equal knots determines the degree
of continuity. If
A quadratic B-spline curve with two inner knots
A NURBS (Non-Uniform Rational B-Spline) curve is a generalization of a B-spline curve,
In addition to the data of a B-spline curve, the NURBS curve
The representation of a NURBS curve is the same as for a B-spline curve except that it also includes
-
${\bf w}$ : A sequence of weights${\bf w} = (w_1, w_2, \ldots, w_n)$ .
We make the assumption that the weights are strictly positive:
Under this condition, a NURBS curve, like its B-spline cousin,
enjoys the convex hull property.
With
A NURBS curve is in GoTools stored using the same entities as
non-rational spline curves. Note that the constructors of these entities assume that
the NURBS coefficients are given in the format:
In GoTools, SplineCurve
inherites ParamCurve
and has thereby the functionality
specified for ParamCurve objects. Functionality specific for a B-spline
curve can be found in the doxygen information. This functionality includes:
- Compute the derivative curve corresponding to a given curve
- Fetch information related to the spline space
- Fetch the control polygon of a spline curve
- Insert new knots into the knot vector of the curve and update the curve accordingly
- Increase the polynomial degree of the curve
- Make sure that the curve has got an open knot vector, i.e., knot multiplicity equal to the order in the ends of the curve
A tensor product B-spline surface is represented by the class
SplineSurface
.
Mathematically, the B-spline surface is defined by the parametrization
with control points
-
$dim$ : The dimension of the underlying Euclidean space. -
$n_1$ : The number of control points with respect to the first parameter. -
$n_2$ : The number of control points with respect to the second parameter. -
$k_1$ : The order (polynomial degree + 1) of the B-splines in the first parameter. -
$k_2$ : The order of the B-splines in the second parameter. -
${\bf u}$ : The knot vector of the B-splines with respect to the first parameter,${\bf u} = (u_1,u_2,\ldots,u_{n_1+k_1})$ . -
${\bf v}$ : The knot vector of the B-splines with respect to the second parameter,${\bf v} = (v_1,v_2,\ldots,v_{n_2+k_2})$ . -
${\bf p}$ : The control points of the B-spline surface,$c_{d,i,j}$ ,$d=1,\ldots,dim$ ,$i=1,\ldots,n_1$ ,$j=1,\ldots,n_2$ . When$dim = 3$ , we have${\bf p} = (x_{1,1},y_{1,1},z_{1,1},x_{2,1},y_{2,1},z_{2,1},\ldots$ ,$x_{n_1,1},y_{n_1,1},z_{n_1,1},\ldots$ ,$x_{n_1,n_2},y_{n_1,n_2},z_{n_1,n_2})$ .
The data of the B-spline surface must fulfill the following requirements:
- Both knot vectors must be non-decreasing.
- The number of control points must be greater than or equal to the order
with respect to both parameters:
$n_1 \ge k_1$ and$n_2 \ge k_2$ .
The properties of the representation of a B-spline surface are
similar to the properties of the representation of a B-spline curve.
The control points
A B-spline surface and its control net
A basis function of a B-spline surface is the product of two basis functions corresponding to B-spline curves,
$ B_{i,k_1,{\bf u}}(u) B_{j,k_2,{\bf v}}(v). $
Its support is the rectangle
A basis function of degree one in both variables
A NURBS (Non-Uniform Rational B-Spline) surface is a generalization of a B-spline surface,
In addition to the data of a B-spline surface, the NURBS surface
has a weights
The representation of a NURBS surface is the same as for a B-spline surface except that it also includes
-
${\bf w}$ : The weights of the NURBS surface,$w_{i,j}$ ,$i=1,\ldots,n_1$ ,$j=1,\ldots,n_2$ , so${\bf w} = (w_{1,1},w_{2,1},\ldots,w_{n_1,1},\ldots$ ,$w_{1,2},\ldots,w_{n_1,n_2})$ .
The weights are required to be strictly positive:
The NURBS surface is represented by SISLSurf and SplineSurface in SISL and GoTools, respectively. As for the curve case, the constructors of SISLSurf and SplineSurface expect the coefficients to be multiplied with the weights.
SplineSurface
inherites ParamSurface
in the GoTools data structure and
implements the functionality described for ParamSurface. Important additional
functionality is listed below:
- Compute the derivative surface and normal surface corresponding to a given surface
- Fetch information related to the spline spaces
- Fetch the control polygon of a spline surface
- Fetch all weights of a NURBS surface
- Grid evaluation of the basis functions related to a surface
- Grid evaluation of the surface
- Insert new knots into the knot vectors of the surface and adapt the surface description accordingly
- Increase the polynomial degrees of the surface
- Fetch information related to the boundary curves of a surface
As shown in the class hierarchy, a spline curve is not the only parametric curve in GoTools although it is the most important one. There are also other curves that share parts of the public interface:
-
BoundedCurve
A bounded curve is a restriction of a parametric curve to a given interval. The interval can be specified either in parameter space, in geometry space or both. In the last case, it must be specified whether the parameter space bound or the geometry space bound is the master. -
ElementaryCurve
An elementary curve is a container for a conic section or a line. This entity will be described in some detail later. -
CurveOnSurface
This class represents a curve lying on a surface.
The CurveOnSurface
entity is often related to a bounded, or trimmed, surface. A
bounded surface is limited by a curve loop where each curve in the loop most
often is represented by a CurveOnSurface. However, a CurveOnSurface is an
entity in its own right. It simply represents a curve lying on a surface. It
can for instance originate from intersecting the surface with a plane.
A CurveOnSurface consists of a parametric surface and two corresponding curves, one curve in the parameter domain of the surface and one spatial curve. The master representation is specified. Some operations may required the existence of one particular of these curves, in particular the parameter curve is requested. It exists functions that compute the missing curve from the existing one.
An ElementaryCurve
is a fairly new concept in GoTools, and until now
such curves have
been entered as entities in an IGES or STEP file. The elementary curves
may also
be represented as spline curves although non-bounded curves must be given a
finite extension. The elementary curves is of the types:
-
Circle
The circle is defined by its center and radius and the plane in which it lies if the dimension of the geometry space is larger than 2. A circle is parameterized in terms of the angle. This is a bounded parameterization. -
Ellipse
An ellipse is represented by a centre, the direction of one semi-axis and the length of the two semi-axis. The plane in which the ellipse lies is required if the dimension of the geometry space is larger than 2. An ellipse is parameterized in terms of the angle which gives a bounded parameterization. -
Line
A line is given by a point and a direction. It has an unbounded parameterization,$t \in [- \infty , \infty ]$ . -
Parabola
A parabola is given by a position,$C$ , a focal distance,$F$ , and a coordinate system,$({\bf x}, {\bf y}, {\bf z})$ . It is described as$f(t) = C + F(t^2 {\bf x} + 2t{\bf y})$ and has an unbounded parameterization,$t \in [- \infty , \infty ]$ . -
Hyperbola
A hyperbola is given by a position, a coordinate system and two distances. The parameterization is unbounded.
Similar to the curve case, GoTools supports also other types of parametric surfaces than spline surfaces. The additional surface types are bounded surface, elementary surface and composite surface. The elementary surfaces are conic surfaces, plane and torus. A composite surface consists of a number of spline surfaces where the associated parameter domains are mapped into one composite domain. The class is not complete in the sense that it does not support all functions specified in the interface for a parametric surface.
A bounded surface
is a trimmed surface defined by an underlying surface and a
trimming loop. The underlying surface is a parametric surface and the loop
consists of a closed sequence of ordered parametric curves, often of type
CurveOnSurface. The trimming loop must lie on the surface and be continuous
with respect to a given tolerance.
Also the ElementarySurface
is quite new in GoTools, and it has
been entered as an entity from IGES or STEP. The elementary surfaces
may also
be represented as spline surfaces although non-bounded surfaces must be given a
finite extension. Operations
involving this curve may, however, be made more efficiently by the knowledge
of the surface type.
The elementary surfaces is of the types:
-
Cone
A cone is described by a location, the cone axis, the radius of the cross section corresponding to the location and the cone angle. The parameterization is given by the angle and the distance along the axis, thus it is unbounded in one parameter direction. -
Cylinder
A cylinder is given by its centre and radius and the cylinder axis. It is parameterized by the angle around the circle and the distance in the axis direction. -
Plane
A plane is given by a point and a normal. It has an unbounded parameterization in both parameter directions. -
Sphere
A sphere is given by its centre and radius. It has an angular parameterization in both parameter directions and thereby bounded. -
Torus
A torus is given by the minor and major radius, a location and an axis. The parameterization is angular in both parameter directions. -
Disc
A disc is a part of a plane limited by a circle and given by its centre, radius, plane normal and an additional vector to generate a coordinate system.
The elementary surfaces described above is placed in a coordinate system to facilitate the parameterization. In addition to the geometric information given for each entity, remaining coordinate system information must be specified.
Getting started
Miscellaneous
Functionality
- Modules
- gotools-core
- compositemodel
- implicitization
- igeslib
- intersections
- isogeometric_model
- lrsplines2D
- parametrization
- qualitymodule
- topology
- trivariate
- trivariatemodel
- viewlib
Dependencies