Maths.Flow

public static class Maths.Flow

Methods

DeSinkQueue

#
public static bool DeSinkQueue(Mesh mesh, Color ground, Color water, out Mesh topography, out Mesh desinkedmesh, out Point3d[] levels, out Line[] debuggingLines, out Mesh[] lakeBottoms, out Mesh[] lakeSurfaces, out string warning, out string failure, CancellationToken token)
Find all pooling properties of a mesh.
mesh (Mesh)Mesh to analyse. This mesh must be valid in all the ways that matter, use the PrepareForDesinking(Mesh, Message[]) method to ensure this is so.
ground (Color)False colour to apply to dry vertices.
water (Color)False colour to apply to wet vertices.
topography (out Mesh)The dry parts of the original mesh.
desinkedmesh (out Mesh)The original mesh projected to the uppermost surface.
levels (out Point3d[])???
debuggingLines (out Line[])???
lakeBottoms (out Mesh[])The bottom surfaces of all lakes.
lakeSurfaces (out Mesh[])The top surfaces of all lakes.
warning (out string)
failure (out string)
token (CancellationToken)Cancellation token.

DrawArrow

#
public static void DrawArrow(Point3d pointA, Point3d pointB, Color col)
pointA (Point3d)
pointB (Point3d)
col (Color)

MeshPerFaceFlow

#
public static (double[], double[], double[], Line[], Line[], List<int>, List<(Polyline, List<double>)>) MeshPerFaceFlow(Mesh m, double[] initialFaceValues, bool globalStreamlines, bool strictMode, CancellationToken ct)
RiR = Roof-in-the-rain A function that takes a mesh and computes a bunch of vectors, one for each face, signifying the amount of water trickling through each face, when the mesh is under a uniform rain from the positive Z axis, and water trickles straight down along the mesh in the steepest direction. For now, all naked edges are assumed to be permeable. Adding waterproof edges ("rain gutters") shouldn't be hard. Caution: Puddle locations don't yet work either, I think! Should be doable, though. Needs testing. Negative values might work, but don't seem to make sense.
m (Mesh)An input mesh that was obtained from the Validate function in this class. Other meshes will cause an exception to be thrown.
initialFaceValues (double[])A per-face array of initial surface water source amount information. Can be null or empty, in which case it will be assumed to stand for uniform Z-rain from above. Otherwise, it needs to be of the same length as the input mesh.
globalStreamlines (bool)A boolean flag that turns the costly computation of global streamlines on or off.
strictMode (bool)Should vertical edges and faces be treated as reasons to throw exceptions?
ct (CancellationToken)The cancellation token
(Item1) A strict per-face array. (Item2) A strict per-vertex array. (Item3) A joint per-topology-vertex array, with the per-vertex flows distributed up onto faces adjacent to longitudinal edges. (Item4) Strictly transversal stream lines emanating from edge centerpoints. (Item5) Strictly longitudinal streamlines. (Item6) The indices of the drainage points (vertices without downstream verts/faces) (Item7) The integrated streamlines, carrying directional but no quantitative information.

PrepareForDesinking

#
public static Mesh PrepareForDesinking(Mesh mesh, out Message[] messages)
Duplicate and prepare a mesh for desinking.
mesh (Mesh)Mesh to prepare.
messages (out Message[])Warnings and errors.
Modified mesh, or null if mesh cannot be prepared.

PropagateOnLevels

#
public static HashSet<(int, int)> PropagateOnLevels(Mesh m, HashSet<int> reachedNodes)
m (Mesh)
reachedNodes (HashSet<int>)

Validate

#
public static Mesh Validate(Mesh m, bool strictMode = false)
Attempts to return a mesh that is suitable input for RiR-analysis:
  • manifold
  • triangles only
  • fully welded
  • consistently rebuilt face normals, pointing upwards (in the positive Z-direction)
Will throw if no such mesh can be found. Such a mesh will carry a flag in its user dictionary, and only flag carriers will be admitted to the MeshPerFaceFlow function.
m (Mesh)An input mesh
strictMode (bool = false)Disallow horizontal and vertical faces and edges. Setting this will make this function very conservative but will make sure that the streamline function has an easy time.
An RiR-mesh as close as possible to the input mesh, endowed with a quality flag in its UserDictionary.