Function cut_outer_edge

Source
pub fn cut_outer_edge<T: CoordsFloat>(
    t: &mut Transaction,
    map: &CMap2<T>,
    e: EdgeIdType,
    [nd1, nd2, nd3]: [DartIdType; 3],
) -> TransactionClosureResult<(), SewError>
Expand description

Cut an edge in half and build triangles from the new vertex.

This function takes an edge of the map’s boundary as argument, cut it in half, and build two triangles from the new vertex.


      +                   +
     / \                 /|\
    /   \               / | \
   /     \     -->     /  |  \
  /       \           /   |   \
 /         \         /    |    \
+-----------+       +-----+-----+
      e

This function expects to operate on a triangular mesh. At the moment, calling it on another type of mesh may result in non-explicit errors (e.g. an internal sew operation will consistently fail due to a dart being non-free) as there is no check on the face’s degree.

§Arguments

  • t: &mut Transaction – Associated transaction.
  • map: &mut CMap2 – Edited map.
  • e: EdgeIdType – Edge to cut.
  • [nd1, nd2, nd3]: [DartIdType; 3] – Free darts used to create the new edges.

§Errors

This function will abort and raise an error if:

  • the transaction cannot be completed,
  • one of the edge’s vertex has no associated coordinates value,
  • one internal sew operation fails.

The returned error can be used in conjunction with transaction control to avoid any modifications in case of failure at attribute level. The user can then choose to retry or abort as he wishes using Transaction::with_control_and_err.