Module utils

Module utils 

Source

Functions§

barycentric_coords
Compute a points barycentrics coordinates w.r.t. the given triangle
c_hull
Compute the convex hull of the given points in 2D
generate_vertices
Sample n vertices (i.e. w_i = 0.0), with coordinates drawn form a Uniform distribution
generate_weighted_vertices
Sample n weighted vertices, with coordinates and weights drawn form a Uniform distribution
get_fourth_point
Given an edge of the triangle and, retrieve the point not on the edge
induced_subcomplex
A 1-simplex and its two incident 2-simplices yield four points, of which all 2-simplices of the given triangulation that consist of any permutation of 3 of these vertices form the induced subcomplex.
is_flippable
Check whether the edge is flippable in the ploygon described all four points.
We call T and e flippable if conv(T) is the underlying space of the induced subcomplex of T.
is_flippable_strict
An edge is flippable if the pointwise union of its induced subcomplex equals the convex hull of all the vertices in the induced subcomplex.
keep_unique_elements
Keep the elements that are unique in the given vector of elements, i.e. that appear exactly once.
keep_unique_elements2
Older, less performant version than keep_unique_elements as found out by Tbolt on discord in rust-questions-and-answers-2
point_in_tri
Check whether the vertex lies inside the given triangle
remove_duplicates
Deprecated: more efficient and readable version is keep_unique_elements; this is kept for learning purposes
Remove duplicates from a list of elements of type T. So keeping only unique elemtents