top refers to a list of vertex lists which defines the topology of the complex under test. Its logic is described here. embd is the array of cartesian coordinates of the respective vertices, as embedded; the global vertex number indexes into embd.
mix (top, embd, sbl) perm returns another (top, embd, sbl) with vertex numbers permuted by perm where sbl is a list of vertex number lists which the test code must track under this permutation. There are many efficient but confusing pieces of code that depend on which vertex of a zone or facet serves as origin of the bcc coordinates. These permutations stress that code so as to reveal bugs.
Morhogenesis calls nz embd vl once per zone with vl for that zone; it is about the simplest possible code to call Zone.newz for each zone described by vl. nz deals with global vertex numbers which it hides from Zone.newz. nz returns a pair:
prep, receives the embedding info and a vertex list such as returned by Glue.morphgen. prep computes two coordinate transformations for a facet: (in, out), into the complex, and out of the complex, via some facet specified by the vertex list. Each transformation takes and returns a pair of vectors: (position * direction), called a Cray or Fray here, suitable for locating a ray. The Cray is in global Cartesian coordinates of the embedding space and the Fray is in facet bcc coordinates. The first function (in) converts from coordinates of the embedding space to those of the facet, sign flipped already. The 2nd goes the other way. In prep, cti is the coordinate transformation from embedding space coordinates to facet coordinates. cto is the inverse matrix. The direction of the normal basis vector depends on the orientation of the facet. prep provides two transformations for a facet that belongs to the boundary of the complex. I use it now for inserting rays into the complex and catching them as they emerge.
prep is at the interface of two abstracted types: Jig.ray and Zone.fray. Having access to embd it is competent to translate between these and needs to manhandle their innards. I suppose that we will have to leak the innards of Zone.fray to Jig.
The invocation jig embd bl inf outf takes the Cartesian vertex coordinates, embd, the yield of morphgen, choices of facets for signal injection and reception, inf and outf, and returns a record {lray; lcurl} of two functions. lray takes and returns values of type cray; it invokes the ray logic. lray is of type curlp and takes performs a curl query about a partially exposed bone.
The type of the in transformation is Cray -> Fray and a synopsis is:
(p, d) -> (I(p - facetOrg), Id)Where I is the linear transformation implemented by matrix cti.
cm is an internal routine that computes distances between vertices in the Cartesian coordinates. When sg is set to [|-1.; 1.; 1.; 1.|] we obtain a Minkowski metric. The test cases now fail for Minkowski.
Proceeding from theory, the three facet basis vectors, expressed in Cartesian coordinates should be ((0, −1, 1), (1, −1, 0), (−1, −1, −1)3−1/2). The matrix cto should be the transpose of this very matrix. (There remains confusion on the sign of the normal basis vector.) inf;; yields [0; 3; 4] contradicting my identification of the ingress facet. Bug in test case definition!