The geometry of AD is handled by a geometric constraint solver that arranges primitives such as points and curves in a state that satisfies the given list of constraints. The constraints can enforce a specific location of a point, length of a line, angle between two lines and so forth. Constraints are particularily useful in the feature modelling approach since they can be set in any order and in a context free fashion. For example some elements can me marked to be symmetrical along a plane before knowing where they will be eventually located in the product.
The solver is guided by a weighting scheme that prioritises some constraints over others; for low weight constraints the system finds the best possible compromise relative to other constraints, for high weight constrainst, only an exact solution is accepted. For example a side seam ending to a hem panel should be in roughly 90° angle relative to the hem, but in most cases small deviations are acceptable. On the other hand a point on the center front plane of a symmetrical product should always stay strictly on the plane.
The system of constraints is solved with an iterative conjugate gradient method.
CONSTRAINTS
Point can be moved to coincide with a point, circle or a sphere. In the case of the sphere, if the point is inside the sphere, it won't be moved to the surface.
An edge length of an object can be set to an exact value or to a even multiply of a given length.
Corner angle between two edges can be fixed to a given value.
Bending constraint tries to minimise the bending energy of an internal edge, i.e. straighten a shape to a plane if no other constraints are present. Bending takes an optional stiffness argument that determines how strongly the straightening works against other constraints.
A point can be locked into a plane, or to a signed direction relative to a plane, i.e. once the point is on the desired side of the plane, not further motion is applied.
Planes can also be used to set a pair of points in a mirrored state relative to the plane.
Graph theoretic distance can be used to embed geometryless graphs into n-dimensions or to untangle random embeddings into a form that is informed by their topology. Every node is moved to a position that matches their distance from every other node, in the graph theoretic sense.
APPENDIX 1: primitives
The geometric primitives used in the processing are mostly points NURBS curves, but some additional elements are used in collision calculations, visualisations etc.
Points are defined by 4 coordinates x, y, z & w.
A line is a directed pair of points.
Non-rational cubic beziers (i.e. curves with exactly 4 unweighted control points), can be used directly when rendering data into SVG, so they are treated as a special case.
Other types of beziers are given as lists of (weighted or unweighted) control points and converted into short line segments for rendering.
NURBS (Non-Uniform Rational Basis Spline) curves are defined with control points, a knot vector and a degree.
Curve's degree determines how many control points influence the curvature at a given point.
Control point's weight can be used to alter the "pull" towards it.
Knot vector can be used to shift the relative influence of control points.
The same control points can be used to construct either clamped, open or closed curves.
Circles can be used as exact constructs in calculations and rendered as approximations.
left: degree 3 NURBS, center: degree 2 NURBS (with (√ 2 / 2) corner weights), right: piecewise bezier circle.
Ellipses behave mostly the same way as circles, but due to the most common use cases, their size is given as 2 diameters instead of radii.
Spheres are mostly used in constraint solving calculations, but can be also visualised in different ways if needed.
Paths are mixed lists of lines, beziers and NURBS curves. Compound paths have multiple sub-paths. In the case of a closed compound path, there is one clockwise outer boundary and one or more counterclockwise hole boundaries.
Rounded paths are defined by corner points, accompanied by corresponding corner radius values.
Arcs are drawn from a given center point and 2 ending points.
Surfaces can be represented as NURBS surfaces of any degree or as Coons patches.
If at least one of the NURBS surface's degrees is 1, the surfaces is a ruled surface.
Coons patches interpolate a given set of either three or four curves.
query
A point at a given t value of a bezier, i.e. between its start and end points, can be derived with De Castejau's algorithm.
A point at knot u value of a NURBS can be derived with De Boor's algorithm.
Curve length is calculated by segmenting it first into short lines and adding the lines' individual lengths together.
Curve's relative curvature can be calculated from an osculating circle's radius at a given point.
Binary search can be used to find a position on a curve that fulfils some requirement, e.g. the closest position to a given point, the position where tangent of the curve matches a given direction etc.
Curve interpolation through a given list of points can be created by solving a linear system of coefficients created from the points.
APPENDIX 2: affine transformations
Affine transformations are parallelism preserving geometric transformations, given in a matrix form. Lists of affines can be merged with matrix multiplication before the are all applied at once.
Translation moves an object into a new position. Translation values are given separately for every axis (x, y, z).
Rotation is also calculated separately for each axis (x, y, z) and then combined into a single matrix.
Scaling can be done uniformly, or with separate value for every axis.
Mirroring needs a mirror plane as an additional input.
Rotation matrix that matches A vector's direction to B vector's direction.
APPENDIX 3: Curve transformations
Inserting a knot retains curve geometry.
Take a NURBS segment between t0 and t1.
NURBS degree elevation happens by first subdividing it into beziers, elevating their degrees and then merging them back into a single NURBS.
Naive NURBS offset is done by by moving controls points of each knot span separately in a 90° angle. Not 100% accurate, but good enough for where it's used at the moment.
Curves can be segmented into lines / points either by using exact mm value (red) or by using fixed t-value step (blue).
Translate NURBS at point t to a given direction. Influences only some of the nearest control points relative to point at t.