Skip to main content

edge

Function edge 

Source
pub unsafe extern "C" fn edge(
    in1: *const c_int,
    in2: *const c_int,
    x: *const c_double,
    y: *const c_double,
    z: *const c_double,
    lwk: *mut c_int,
    iwk: *mut c_int,
    list: *mut c_int,
    lptr: *mut c_int,
    lend: *mut c_int,
    ier: *mut c_int,
)
Expand description

Swaps arcs to force two nodes to be adjacent.

Given a triangulation of n nodes and a pair of nodal indexes in1 and in2, this routine swaps arcs as necessary to force in1 and in2 to be adjacent. Only arcs which intersect in1 -in2 are swapped out. If a Delaunay triangulation is input, the resulting triangulation is as close as possible to a Delaunay triangulation in the sense that all arcs other than in1-in2 are locally optimal.

A sequence of calls to edge may be used to force the presence of a set of edges defining the boundary of a non-convex and/or multiply connected region, or to introduce barriers into the triangulation. Note that getnp will not necessarily return closest nodes if the triangulation has been constrained by a call to edge. However, this is appropriate in some applications, such as triangle-based interpolation on a nonconvex domain.

ยงArguments

  • in1, in2 - Input. The indexes (of x, y, and z) in the range 1 to n defining a pair of nodes to be connected by an arc.
  • x[n], y[n], z[n] - Input. The coordinates of the nodes.
  • lwk - Input/output. On input, the number of columns reserved for iwk. This must be at least ni, the number of arcs that intersect in1-in2. (ni is bounded by n - 3.) On output, the number of arcs which intersect in1-in2 (but not more than the input value of lwk) unless ier = 1 or ier = 3. lwk = 0 if and only if in1 and in2 were adjacent (or lwk = 0) on input.
  • iwk[2 * lwk] - Output. The indexes of the endpoints of the new arcs other than in1-in2 unless 0 < ier or lwk = 0. New arcs to the left of in1->in2 are stored in the first k-1 columns (left portion of iwk), column k contains zeros, and new arcs to the right of in1->in2 occupy columns k + 1, ..., lwk. (k can be determined by searching iwk for the zeros.)
  • list[6 * (n - 2)], lptr[6 * (n - 2)], lend[n] - Input/output. The data structure defining the triangulation, created by trmesh. On output, updated if necessary to refelct the presence of an arc connecting in1 and in2 unless 0 < ier. The data structure has been altered if 4 <= ier.
  • ier - Output. Error indicator:
    • 0, if no errors were encountered
    • 1, if in1 < 1, in2 < 1, in1 = in2, or lwk < 0 on input.
    • 2, if more space is required in iwk. Refer to lwk.
    • 3, if in1 and in2 could not be connected due to either an invalid data structure or collinear nodes (and floating point error).
    • 4, if an error flag other than ier = 1 was returned by optim
    • 5, if error flag 1 was returned by optim. This is not necessarily an error, but the arcs other than in1-in2 may not be optimal