Artificial Designer's geometry uses homogeneous coordinates and is mostly constructed with NURBS curves.

primitives

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.

Simple curve interpolation can be done by first creating a Catmull-Rom spline out of given points (red), which are converted into NURBS controls.

In more complicated cases, a simulated annealing algorithm can be used to find a curve that passes through a given list of points. The input points are first used as control points for a baseline NURBS curve, whose knots, control positions and control weights are mutated until a close enough match is found. The accuracy and desired curve properties can be constrained to different values depending on the use case.

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 axis as an additional input.

Rotation matrix that matches A vector's direction to B vector's direction.

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.