Loyc.Utilities

qwertie edited this page Aug 14, 2014 · 2 revisions

This assembly contains miscellaneous code that is not considered universal enough to be in Loyc.Essentials, or classes that depend on Loyc.Collections and/or Loyc.Syntax. A couple of things in here are old and should be removed.

Currently, the most useful stuff in here is probably the Geometry code:

  • BoundingBoxMath class: algorithms involving bounding boxes, e.g. Point.ProjectOnto(bbox)
  • LineMath class: algorithms involving lines or line segments, e.g. SimplifyPolyline(), Point.ProjectOnto(line), line1.ComputeIntersection(line2, ...)
  • PointMath class: algorithms involving points and vectors, e.g. a.Dot(b), a.Cross(b), vec.Normalized(), ComputeConvexHull(), etc.
  • PolygonMath class: algorithms involving polygons, PolygonArea(), Orientation(), IsPointInPolygon(), etc.

Another useful feature is the command-line processor, UG.ProcessCommandLineArguments(). It supports unix-style short and long options (e.g. -aR --input=input.txt --out output.txt, where -aR is recognized as two separate options -a -R that have registered long forms.)