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.
collinear2d?
(collinear2d? e1 e2)
True if the projections of edges e1
, e2
onto the x, y plane are collinear.
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.
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.
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.
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.