﻿ Coordinates

# Coordinates

Objects in drawings are defined by the coordinates necessary to draw them. Coordinates are simply the numbers for each X and Y (and possibly Z) position that defines the object. The sequence of coordinates that defines an object is also called its metric.   Coordinates for objects are stored within a geom data type in records within the drawing's table.

Consider a drawing that contains five objects: an area, a line and three points.

The objects in the drawing are defined by the coordinate numbers that are used to draw them in a "connect the dots" fashion.   The coordinate numbers for each object are stored within the geom field in the record that stores data for that object.   The area, for example, is nothing more than a list of five coordinates within the geom that defines the area.

3 7

2 9

3 10

5 9

5 8

Manifold knows how to interpret a geom to make sense of the coordinate numbers it contains as an area, a line or a point as the case may be.  Manifold understands how to use the coordinate numbers for each object type, for example, knowing how to draw the area correctly to show what is the inside and what is the outside of the area.

Manifold uses geoms to store the coordinates that define objects because the binary geom data type is compact, unambiguous and very efficient. A big, complicated area such as the one that might define the boundary of continental Canada, replete with endlessly convoluted shoreline might consist of many tens of thousands of coordinates even at fairly low resolution.

Note that to correctly use coordinate numbers as spatial data we must have additional information such as the coordinate system within which they are to be interpreted.

By themselves the raw coordinate numbers describe only the relative position and shape of objects within the drawing.    If we do not have coordinate system information we would not know, for example, if the number 3 in the area's coordinates is supposed to be three centimeters or if it is three degrees of longitude. If the 3 is not degrees of longitude we do not know from the number by itself if it is supposed to represent an unprojected coordinate in a CAD drawing or if it is a number that has some meaning within some specific geographic coordinate system.

In Manifold the properties of the table which contains the geom tell Manifold the coordinate system within which the coordinates are to be interpreted. Between the table's properties and the coordinate information in the geom we have precise and complete information on the exact placement and shape of the object.

### Pathological Metrics

Nothing says that all metrics for all objects must always be sensible.  Especially when objects are created by programmatic processes the metric created may be perfectly legal but might not be sensible.    Area objects, for example, might contain redundant coordinates or consist of coordinates that are placed in topologically crazy orders, for example, causing areas to overlap themselves.

Consider the area object shown in the first two illustrations below, with the coordinates that define it marked by square symbols. The blue square symbol marks a location where two coordinates exist, both exactly at the same place.

The area is defined by traversing the coordinates which mark the boundary of the area, as shown by the blue arrows in the second illustration above.   The outlying coordinate is redundant, because there is no area out there.  One of the two coincident coordinates at the location marked by the blue square is also redundant, since its only purpose is to send out or to catch the path out to the outlying, redundant coordinate.  If two redundant coordinates are removed the area becomes a normalized area that is not pathological, that is, it does not contain any crazy or unnecessary coordinates.

## Notes

A simplification - This topic simplifies the nature of coordinates in a geom.  From the New Object Dialog topic we can see that in addition to the classic specification of points, lines and areas by coordinates that draw the object in connect-the-dots fashion Manifold can also specify lines and areas using curvilinear segments where the coordinate numbers specify circle arcs, ellipse arcs or splines.

Tables

Drawings

New Object Dialog

Projections

Transform Templates - Geom - See the Normalize and Normalize Topology templates, as well as others that work with coordinates.

Example: Draw Lines, Areas and Points - Simple example of using basic mouse moves to add points, lines and areas to a drawing.

Example: Drawings use Geom Fields in Tables  - An essential discussion on how drawings are created from geom fields in tables, including how the drawing knows which coordinate system to use.

Example: Create a Geocoded Table from a Drawing - A partner example to Example: Create a Drawing from a Geocoded Table   A geocoded table has records with a latitude and longitude for each record.   This example starts with a table for a drawing of points where the geom field in the table contains geometry information for each point.   We extract the Y and X locations for each point  from the geom field to create latitude and longitude fields in the table for each record.

Example: Create a Drawing from a Geocoded Table - A partner example to Example: Create a Geocoded Table from a Drawing   A geocoded table has records with a latitude and longitude for each record.   This example starts with a table containing a list of cities with a latitude and longitude field for the location of each city.   We create a geom from the latitude and longitude fields using a template in the Transform dialog and then we create a drawing that shows the cities as points.  This example shows all the infrastructure steps involved.