Warning

The text below is a bit sloppy considering different spline curve types. The Bézier curves are not defined in the same way as the Cubic spline curves. See note at the end for a bit more exactness.

I always knew I should have paid more attention to the theory on university computer graphics lessons. Now I have to learn some things the hard way, like the proper handling of Bézier curves. For you as the users of WOML, this unfortunately means iterative improvements in the WOML geometry models.

WOML Core uses Cubic Splines (or Cubic Bézier curves) to describe the smooth control paths for line and area objects. I have used GM_Curve class of ISO 19107 standard (Geographic Information) as the reference model for implementing these curve types in WOML. GM_Curve defines a continuous curve by using 1..n connected curve segments (GM_CurveSegment). In GML 3.1 the type implementing the ISO GM_Curve model is gml:CurveType. This definition is very flexible, as each curve segment may use different curve interpolation method.

For the current WOML version (2010/05/28) I have tried to restrict the curve expression complexity by allowing only Cubic Spline type segments in the control curves for line objects. For the WOML area objects the model is even more restricted: the outer and inner boundaries (or Rings) each have only one implicit curve segment. The aim has been to make the programming the software using WOML objects easier by only using the curve types really needed for WOML objects. However as it seems the simplification has gone a bit too far in the case of area objects. The single curve segment model means that the exterior and interior Cubic Spline boundaries have to be so called Natural Splines, which semm to be far less supported in existing computer graphics software packages then the basic Cubic Bézier curves. Our software developers recently ask for the possibility to define all the WOML control curves with Cubic Bézier curve segments each having only four points: the start and the end points and two points defining curve tangent vector directions at those points. For the WOML line objects this is no problem: it is perfectly OK to give only two control point positions for each segment, and the tangent vectors can be give by vectorAtStart and vectorAtEnd properties. But for the area types the geometry model would have to change a bit.

As I was reconsidering the geometries of the WOML line and area objects, more improvement ideas came into my mind (as painfully often happens). The current dual model on either using spline or line string curves for defining the control curve seemed somewhat ugly and not really flexible enough: Especially for some areas, it really should be possibly to define the boundary curves partly with sharp-egded curves and partly with smooth curves. Also the property name polygonControlCurve in woml:AbstractLineObjectType is a misnomer: As an open curve it's not a polygon, but a line string. Furthermore the possibility of defining the geometry of an area object only indirectly by using targetRegion property instead of giving the geometry inline now seemed like a design mistake: Each WOML Feature should have a clearly defined primary geometry property. For these reasons I decided to remodel the geometry properties and types for the next WOML version. The good news is that the new geometry model is simpler and harmonized between both line and (surface) area types.

The diagrams shown above describes the properties of the current and the new woml:AbstractLineObjectType}}s side by side. The old choice between the {{splineControlCurve and polygonControlCurve has been replaced by a single controlCurve property of type CombinedSegmentedCurvePropertyType. This property may contain an element of type CombinedSegmentedCurveType defining a curve by 1..n cubic spline or line string segments (combinedSegments-element):

In this way the control curves for all the WOML line objects may consist of arbitrary sequences of cubic spline or line string segments. These segments are also now defined by directly using the gml:CubicSpline and the gml:LineStringSegment elements. The redundant and optional interpolatedCurve property remains the same as before: software may use the existing lines string interpolation of the whole curve for rendering if the interpolation attributes indicate a good enough fit considering the target rendering resolution. The idea is to make it easier for the software implementations to re-project the curves in some typical conditions as they don't have to recalculate the spline curves for the target map projection.

The (surface) area objects now have very similar changes in defining their geometries:

The former double-choice of providing a geometry is replaced by providing controlSurface property of type CombinedSegmentedSurfacePropertyType and a separate interpolatedSurface and the targetRegion/targetRegionReference choice. The exterior and interior properties of the contained surface element are of type CombinedSegmentedRingType, which in turn used the same combinedSegments element as the CombinedSegmentedCurveType for line objects:

These changes will be published as part of the next WOML Core version which is scheduled for the beginning of August 2010. The major release of the WOML Core also means a simultaneous major release for the WOML SWO, WOML Quantity and WOML Textfct schemas.

Finally a couple of links for those who have been bee patient enough to read this post up to this point: The first one is a very interesting wikipedia article about the ship-building origins of the Spline curves before the computer graphics. The second is much more boring, but possibly useful: If you don't want to pay 238 Swiss frangs for the ISO/DIS 19107 standard document, you can download it for free from the OGC portal.

About different spline types

A cubic Bézier curve segment is defined by four points in space. The curve itself always passes through first and the last of these points, whereas the second and the third point define the shape of the curve between the endpoints.

The Cubic spline curves consist n control points. A spline curve is called an interpolating curve if it passes through all its control points. If it's not required to do so, it is called an approximating curve. For interpolating spline curves (which are of most interest in here) there are several methods of interpolation, like Natural, Hermite, Catmul-Rom and Cardinal splines. These differ in ways it's possible to define the behavior of the interpolated curve between the control points. I will not go into the details here, but a pretty straight-forward explanations for these methods can be found from wikipedia page on Cubic Hermite spline

Quoting the schema documentation of the gml:CubicSplineType:

Cubic splines are similar to line strings in that they are a sequence of segments each with its own defining function. A cubic spline uses the control points and a set of derivative parameters to define a piecewise 3rd degree polynomial interpolation. Unlike line-strings, the parameterization by arc length is not necessarily still a polynomial. The function describing the curve must be C2, that is, have a continuous 1st and 2nd derivative at all points, and pass through the controlPoints in the order given. Between the control points, the curve segment is defined by a cubic polynomial. At each control point, the polynomial changes in such a manner that the 1st and 2nd derivative vectors are the same from either side. The control parameters record must contain vectorAtStart, and vectorAtEnd which are the unit tangent vectors at controlPoint[1] and controlPoint[n] where n = controlPoint.count. Note: only the direction of the vectors is relevant, not their length.

This description does not directly mention the name of the intended spline interpolation method, but it does say that the vectorAtStart and the vectorAtEnd are mandatory and they should be interpreted as unit vectors (only the direction, not length matters). Also it is required that function describing the curve (segment?) must be C2. This seems to indicate that curve segments defined by using elements of type gml:CubicSplineType are meant to be interpolated as Natural cubic splines (a change in any of the control points changes the entire curve). If the continuity between the segments is allowed to be less than C2, control point changes in one segment can be limited to affect only that curve segment.

  • No labels