Module cg_math::utils

source ·

Functions

  • Compute a points barycentrics coordinates w.r.t. the given triangle
  • Compute the convex hull of the given points in 2D
  • Sample n vertices (i.e. w_i = 0.0), with coordinates drawn form a Uniform distribution
  • Sample n weighted vertices, with coordinates and weights drawn form a Uniform distribution
  • Given an edge of the triangle and, retrieve the point not on the edge
  • 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.
  • 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.
  • 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 the elements that are unique in the given vector of elements, i.e. that appear exactly once.
  • Older, less performant version than keep_unique_elements as found out by Tbolt on discord in rust-questions-and-answers-2
  • Check whether the vertex lies inside the given triangle
  • 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