Concepts

Drawmetry is based on a few central concepts that are explained below.

Point Variable

The plane is made up of points. Point variables are like small containers that contain a single point. That point is the point variable's value. A point variable may have different values at different times, hence the word variable. One can also think of a point variable as a point that can move and its value as the point's position, although mathematically this is not quite correct, since points do not move. In Drawmetry, a point variable is vizualized by a small green, orange or red dot placed at its current value. When a point variable is selected the dot is turned into a square. Point variables are introduced into a drawing by double-clicking on the canvas in the "Insert point" mode. That implicitely assigns a value to the point variable, which is the point where the double-click occured.

Point variables have several functions. First, they serve as anchor points to the shapes of a drawing. For instance, every line segment is anchored to the point variables at its end points. If one of these point variables is deleted, the line segment is deleted too. A polygone is anchored to a point variable at each of its vertices. If one of these point variables is deleted, the correponding vertex is removed. Cells and traces may, but need not, be anchored to point variables. When any of the point variables to which a shape is anchored moves, the shape moves with it.  Point variables thus serve as handles to the shapes.

Secondly, point variables may be referenced in constraints. The position of one point variable may determine the position of another point variable through a constraint. A point variable P_0 may be referenced in a the constraint of another point variable P_1; for instance P_1 may have the constraint "=horizontal(P_0)". If P_0 and P_1 are the two point variables associated with the end points of a line segment, then the line would have to be horizontal.

Constraint

A constraint, as the name suggests, constrains the set of possible values that a point variable may take. A constraint is expressed using a formula. An example of a constraint is: "P_1 = distance(P_0, 100)". This formula expresses a constraint on P_1, stating the P_1's value must be at a distance of 100 points (1 point = 1/72 inch) from P_0's value. P_1 is the constraint's target, and P_0 and 100 are the constraint's predecessors. Every constraint has exactly one target and zero or more predecessors. The target of one constraint may be a predecessor of another constraint. The target is a dependent of the predecessors. The dependecy relationship is closed under transitivity, meaning that if P_1 is a dependent of P_0 and P_2 is a dependent of P_1, then P_2 is a dependent of P_0. No entity (point variable or other type of variable) can be a dependent of itself. Two constraints cannot have the same target, or equivalently, an entity can have at most one constraint.

It is sometimes useful to depict the constraints. The figures below provide a way of doing this.

 

Figure 1: Depiction of a constraint

Figure 1 shows a constraint. The constraint A is represented by a square. The predecessors a and b are represented by circles with arrows from the predecessors to the constraint. The target c is also represented by a circle with an arrow from the constraint to the target.

Figure 2: A constraint graph

Constraints may be connected in a constraint graph. In a constraint graph, the target of one constraint may be a predecessor of another constraint. In Figure 2, the entity c is the target of constraint A and a predecessor of constraint B. The entity a is a predecessor of both A and B. If the user does something that causes the value of either a, b or c to change, then both A and B must fire to ensure that the values of c and d satisfy the constraints. If the user does something that causes the value of d to change, then B must fire. When a constraint fires, the target is assigned a value that satisfies the constraint. If there exists more than one value that satisfies the constraint, the target is assigned the value that is nearest to the target's current value.

Figure 3: Two constraints with the same target

Left side of Figure 3 illustrates a forbidden situation where two constraints have the same target. Sometimes two constraints can be combined into one. If constraints A and B are combinable, a possible constraint graph is shown on the right side of Figure 3, where the constraints A and B have been combined to one constraint "A and B". Not all constraints are combinable. For instance, "=horizontal(P_x)", which constrains its target point variable to be horizontally aligned with P_x, and "=vertical(P_y)", which constrains its target point variable to be vertically aligned with P_y,  can be combined into "=horizontal(P_x) and vertical(P_y)".  However, "center(P_x, P_y), which places its target point variable at the center of P_x and P_y, cannot be combined with any other constraint.

Figure 4: A constraint graph with a cycle.

Figure 4 illustrates another forbidden situation where there is a cycle in the constraint graph. In this case d is a dependent of c which is a dependent of d, making both c and d dependent of themselves.

Note that the forbidden situations in the two figures above will never occur since Drawmetry will not allow a constraint to be inserted if it violates any of the rules. If the user enters a constraint that is not valid, a message is displayed in the feedback field to the bottom left of the application window.

Anchor

An anchor determines where a trace or a cell is positioned in a drawing. Since these elements may move, an anchor is a variable. Like point variables, anchors may be constrained. There are three possible anchor constraints: one-point, two-point, or three-point.

Figure 5: A one-point anchor constraint

A one-point anchor constraint has one predecessor, which must be a point. Since the only way to reference a point in Drawmetry is through a point variable, the predecessor must be a point variable. A one-point anchor constraint keeps the position of its target (whether it is a cell or a trace) fixed relatively to its predecessor. Figure 5 shows a cell (in green) that is anchored at a point variable located at the green crosse hairs. The text in red shows where the cell would be located if it the point variable were moved to the red crosse hairs.

Figure 6: A two-point anchor constraint

A two-point anchor has two point variables as predecessors. The order of the predecessors is insignificant. A two-point constraint keeps the position, direction and scale fixed relatively to its predecessors. If the distance between the predecessors is changed, the target is scaled proportionally; if the direction from the first to the second predecessor changes, the target is rotated by the same amount; etc. The proportions of the target remain unchanged while anchored to two point variables, e.g, a circle will remain a circles but the radius may change, and a square cell will remain square but the size and orientation may change. Figure 6 shows a cell (in green) anchored at point variables located at the green crosse hairs. The text in red shows where the cell would be located if it the point variables were moved to the red crosse hairs.

Figure 7: A three-point anchor constraint

A three-point anchor has three points as predecessors. A three-point anchor constraint may change the proportions of the target. For instance, an ellipse may be drawn by first drawing a circle, anchoring the circle to three points and moving one of the points so that its position relatively to the two other points changes.  Figure 7 shows a cell (in green) anchored at point variables located at the green crosse hairs. The text in red shows where the cell would be located if it the point variables were moved to the red crosse hairs.

Examples of how to use anchors effectively are given in the tutorials.

Snapping

Snapping is a feature that allows the user to merge two point variables into one. When a point varaible P_x is snapped to a point variable P_y, all the successors of P_x (i.e., the constraints that have P_x as one of the predecessors) are transferred to P_y. The constraints of P_x and P_y are combined into one constraint and added to P_y.

There are several conditions that must be fulfilled before snapping can take place. First, neither of the two point variables can be a dependent of the other since that would cause P_y to become a dependent of itself. Secondly, the constraints of P_x and P_y must be combinable. If either P_x or P_y does not have a constraint, then there is no problem, but if they both are constrained, their constraints must be combinable.

Snapping of a point variable P_x with a point variable P_y is achieved in Default edit mode, by dragging P_x toward P_y and releasing the mouse button, when the cusor is above P_y.

Another form of snapping is snapping of a point variable to a line. If a point variable P_x is dragged to a line segment that has P_y and P_z at its end points, and the mouse button is released while the cursor is above the line segment, the constraint "= colinear(P_y, P_z)" is either added to P_x (if P_x does not already have a constraint) or, if possible, combined with P_x's existing constraint. The colinear constraint keeps P_x on the line passing through P_y and P_z. 

Degrees of Freedom

Degrees of freedom (DOF)  of a point variable is defined as the dimension of the space in which the point variable may move while satifying its constraint. A free point variable (i.e., a point variable that is not constrained) can take any point in the two dimensional plane as value, and thus has two DOF. A point variable P_x that is constrained by "P_x = colinear(P_y, P_z)" can move freely on the line through P_y and P_z without breaking the constraint, so it has one DOF.

DOF can be extended to drawings. For instance, a circle is determined by it center (2 DOF) and its radius (1 DOF) and thus has 3 DOF. A rectangle that has its sides either vertical or horizontal has 4 DOF; 2 DOF for the upper left corner , 1 for the width, and 1 for the height. If the rectangle is not constrained to have its sides horizontal or vertical, it has 5 DOF; the 4 from above and one for the angle of inclination. Likewise, an arbitrary ellipse has 5 DOF. The DOF of a drawing can be determined by adding the DOF of all the point variables.

The DOF of a drawing may be distributed to the point variables in different ways while the total number remains constant. For instance, a rectangle whose sides are horizontal or vertical, which has 4 DOF, may have 2 DOF at one corner, and the other 2 DOF at the opposite corner. Alternatively, it may have 2 DOF at one corner and 1 DOF at each of the adjacent corners. The choice between these two options is a matter of convenience. Concentrating the DOF on as few point variables as possible, allows the user to adjust the position and size of the drawing with the fewest mouse movements. However, the latter option allows the user to adjust width and height individually and thereby have more fine control. The choice also affects the manner in which the drawing can be snapped into a larger drawing. It may, for instance,  be desirable to have a free point variable at the center of the top side of the rectangle and another free point variable at one of the corners on the bottom side. The point variables at the three other corners are constrained and have 0 DOF. This allows the rectangle's top side to be centered relatively to a given point variable simply by snapping it into place.