walkmap.edge

Essentially the specification for things we shall consider to be an edge. An edge is a line segment having just a start and an end, with no intervening nodes.

centre

(centre edge)

Return the vertex that represents the centre of this edge.

collinear2d?

(collinear2d? e1 e2)

True if the projections of edges e1, e2 onto the x, y plane are collinear.

collinear?

(collinear? e1 e2)

True if edges e1 and e2 are collinear with one another.

edge

(edge v1 v2)

Return an edge between vertices v1 and v2.

edge?

(edge? o)

True if o satisfies the conditions for a edge. An edge shall be a map having the keys :start and :end, such that the values of each of those keys shall be a vertex.

intersection2d

(intersection2d e1 e2)

The probability of two lines intersecting in 3d space is low, and actually that is mostly not something we’re interested in. We’re interested in intersection in the x,y plane. This function returns a vertex representing a point vertically over the intersection of edges e1, e2 in the x,y plane, whose z coordinate is

  • 0 if both edges are 2d (i.e. have missing or zero z coordinates);
  • if one edge is 2d, then the point on the other edge over the intersection;
  • otherwise, the average of the z coordinates of the points on the two edges over the intersection.

If no such intersection exists, nil is returned.

It is an error, and an exception will be thrown, if either e1 or e2 is not an edge.

length

(length e)

Return the length of the edge e.

minimaxd

(minimaxd edge coord f)

Apply function f to coord of the vertices at start and end of edge and return the result. Intended use case is f = min or max, coord is :x, :y or :z. No checks are made for sane arguments.

on2d?

(on2d? e v)

True if vertex v is on edge e when projected onto the x, y plane.

on?

(on? e v)

True if the vertex v is on the edge e.

orientation

(orientation p q r)

Determine whether the ordered sequence of vertices p, q and r run clockwise, collinear or anticlockwise in the x,y plane.

overlaps2d?

(overlaps2d? e1 e2)

True if the recangle in the x,y plane bisected by edge e1 overlaps that bisected by edge e2. It is an error if either e1 or e2 is not an edge.

parallel?

(parallel? & edges)

True if all edges passed are parallel with one another.

unit-vector

(unit-vector e)

Return an vertex parallel to e starting from the coordinate origin. Two edges which are parallel will have the same unit vector.