Determine the relative orientation of three points in two-dimensional space. The result is also an approximation of twice the signed area of the triangle defined by the three points. This method is fast - but not robust against issues of floating point precision. Best used with integer coordinates. Adapted from https://github.com/mourner/robust-predicates
An endpoint of segment AB, relative to which point C is tested
An endpoint of segment AB, relative to which point C is tested
A point that is tested relative to segment AB
The relative orientation of points A, B, and C A positive value if the points are in counter-clockwise order (C lies to the left of AB) A negative value if the points are in clockwise order (C lies to the right of AB) Zero if the points A, B, and C are collinear.
Quickly test whether the line segment AB intersects with the line segment CD. This method does not determine the point of intersection, for that use lineLineIntersection
The first endpoint of segment AB
The second endpoint of segment AB
The first endpoint of segment CD
The second endpoint of segment CD
Do the line segments intersect?
An internal helper method for computing the intersection between two infinite-length lines. Adapted from http://paulbourke.net/geometry/pointlineplane/
The first endpoint of segment AB
The second endpoint of segment AB
The first endpoint of segment CD
The second endpoint of segment CD
Options which affect the intersection test
An intersection point, or null if no intersection occurred
An internal helper method for computing the intersection between two finite line segments. Adapted from http://paulbourke.net/geometry/pointlineplane/
The first endpoint of segment AB
The second endpoint of segment AB
The first endpoint of segment CD
The second endpoint of segment CD
An intersection point, or null if no intersection occurred
Determine the intersection between a candidate wall and the circular radius of the polygon.
The initial vertex of the candidate edge
The second vertex of the candidate edge
The center of the bounding circle
The radius of the bounding circle
A small tolerance for floating point precision
The intersection of the segment AB with the circle
Identify the point closest to C on segment AB
The reference point C
Point A on segment AB
Point B on segment AB
The closest point to C on segment AB
Determine the points of intersection between a line segment (p0,p1) and a circle. There will be zero, one, or two intersections See https://math.stackexchange.com/a/311956
The initial point of the line segment
The terminal point of the line segment
The center of the circle
The radius of the circle
Benchmark the performance of a function, calling it a requested number of iterations.
The function to benchmark
The number of iterations to test
Additional arguments passed to the benchmarked function
A debugging function to test latency or timeouts by forcibly locking the thread for an amount of time.
A number of milliseconds to lock
Wrap a callback in a debounced timeout. Delay execution of the callback function until the function has not been called for delay milliseconds
A function to execute once the debounced threshold has been passed
An amount of time in milliseconds to delay
A wrapped function which can be called to debounce execution
Quickly clone a simple piece of data, returning a copy which can be mutated safely. This method DOES support recursive data structures containing inner objects or arrays. This method DOES NOT support advanced object types like Set, Map, or other specialized classes.
Some sort of data
Options to configure the behaviour of deepClone
The clone of that data
Deeply difference an object against some other, returning the update keys and values.
An object comparing data against which to compare
An object containing potentially different data
Additional options which configure the diff operation
An object of the data in other which differs from that in original
Test if two objects contain the same enumerable keys and values.
The first object.
The second object.
A cheap data duplication trick which is relatively robust. For a subset of cases the deepClone function will offer better performance.
Some sort of data
Test whether some class is a subclass of a parent. Returns true if the classes are identical.
The class to test
Some other class which may be a parent
Is the class a subclass of the parent?
Encode a url-like string by replacing any characters which need encoding To reverse this encoding, the native decodeURIComponent can be used on the whole encoded string, without adjustment.
A fully-qualified URL or url component (like a relative path)
An encoded URL string
Expand a flattened object to be a standard nested Object by converting all dot-notation keys to inner objects.
The object to expand
An expanded object
Filter the contents of some source object using the structure of a template object. Only keys which exist in the template are preserved in the source object.
An object which contains the data you wish to filter
An object which contains the structure you wish to preserve
Additional options which customize the filtration
Flatten a possibly multi-dimensional object to a one-dimensional one by converting all nested keys to dot notation
The object to flatten
A flattened object
Obtain references to the parent classes of a certain class.
An ES6 Class definition
An array of parent Classes which the provided class extends
Get the URL route for a certain path which includes a path prefix, if one is set
The Foundry URL path
A path prefix to apply
The absolute URL path
Learn the underlying data type of some variable. Supported identifiable types include: undefined, null, number, string, boolean, function, Array, Set, Map, Promise, Error, HTMLElement (client side only), Object (catchall for other object types)
A provided variable
The named type of the token
A helper function which tests whether an object has a property or nested property given a string key. The method also supports arrays if the provided key is an integer index of the array. The string key supports the notation a.b.c which would return true if object[a][b][c] exists
The object to traverse
An object property with notation a.b.c
An indicator for whether the property exists
A helper function which searches through an object to retrieve a value by a string key. The method also supports arrays if the provided key is an integer index of the array. The string key supports the notation a.b.c which would return object[a][b][c]
The object to traverse
An object property with notation a.b.c
The value of the found property
A helper function which searches through an object to assign a value using a string key This string key supports the notation a.b.c which would target object[a][b][c]
The object to update
The string key
The value to be assigned
Whether the value was changed from its previous value
Invert an object by assigning its values as keys and its keys as values.
The original object to invert
The inverted object with keys and values swapped
Return whether a target version (v1) is more advanced than some other reference version (v0). Supports either numeric or string version comparison with version parts separated by periods.
The target version
The reference version
Is v1 a more advanced version than v0?
A simple function to test whether an Object is empty
The object to test
Is the object empty?
Test whether a value is empty-like; either undefined or a content-less object.
The value to test
Is the value empty-like?
Update a source object by replacing its keys and values with those from a target object.
The initial object which should be updated with values from the target
Additional options which configure the merge
The original source object including updated, inserted, or overwritten records.
Parse an S3 key to learn the bucket and the key prefix used for the request.
A fully qualified key name or prefix path.
Generate a random string ID of a given requested length.
The length of the random ID to generate
Return a string containing random letters and numbers
Express a timestamp as a relative string
A timestamp string or Date object to be formatted as a relative time
A string expression for the relative time
A wrapper method around fetch
that attaches an AbortController signal to the fetch
call for clean timeouts
The URL to make the Request to
The data of the Request
A small wrapper that automatically asks for JSON with a Timeout
The URL to make the Request to
The data of the Request
Log a compatibility warning which is filtered based on the client's defined compatibility settings.
The original warning or error message
Additional options which customize logging
A utility function to reload the page with a debounce.
Utility functions providing helpful functionality.