Process a facet. Normals are not guaranteed to be present (binary yes, ascii no).
A basic IO handler for file drop (Drag-and-drop).
Example use:
var body = document.getElememtByTagName("body")[0];
var fileDrop = new FileDrop(body);
fileDrop.onFileJSONDropped(function (jsonObject) {
console.log("jsonObject", jsonObject);
});
Splitting a polygon at a self intersection results in two new polygons.
Some often-used interfaces.
Defining some basic SVG command types.
As these types do not define all very possible path data strings they should cover the most daily use-cases.
For more insight see https://www.w3.org/TR/SVG/paths.html
Handler type for path-removed listeners.
Handler type for mouse-pointer-moved listeners.
Handler type for vertex-inserted listeners.
Handler type for vertex-removed listeners.
A type for SVG <path d="..." /> params. Example: [ 'A':string, radiusx:number, radiusy:number, rotation:number, largeArcFlag=1|0, sweepFlag=1|0, endx:number, endy:number ]
A unique identifier (UID) to tell drawables apart in a performant manner.
A simple wavefront OBJ parser.
Inspired by https://webglfundamentals.org/webgl/lessons/webgl-load-obj.html
For circle-polygon-intersection-count detection we need an epsilon to eliminate smaller precision errors.
A set of beautiful web colors (I know, beauty is in the eye of the beholder).
I found this color chart with 11 colors and think it is somewhat nice https://www.pinterest.com/pin/229965124706497134/
A mix of green shades.
This function cuts a given self-intersecting polygon into non-self-intersecting sub polygons.
The algorithm only works for non-self-overlapping polygons: Please note that the union set of the sub polygons themselves will not be disjunct if the input polyon overlaps with itself!
See this illustration for details: ./demos/27-polygon-intersection-greinerhormann/splitting-polygon-types.png
An equivalent of lodash.array_fill(...).
Randomize a given array in-place.
Remove all duplicate neighbours from the given polygon.
Imagagine a polygon: [ [0,0], [10,10], [10,10], [10,10], [20,20], [10,10], [30,30], [0,0] ]
The returned vertex array will then be: [ [10,10], [20,20], [10,10], [30,30], [0,0] ]
Duplicate neighbours (and only neightours) of a run of any length will be removed.
The polygon vertices to use.
The epsilon area to use around each vertex to check equality.
Compute the max sized inlying circle in the given convex (!) polygon - also called the convex-polygon incircle.
The function will return an object with either: the circle, and the triangle that defines the three tangent points where the circle touches the polygon.
Inspired by https://observablehq.com/@mbostock/convex-polygon-incircle https://observablehq.com/@mbostock/circle-tangent-to-three-lines
The actual convex polygon.
A pair of a circle (the incircle) and a triangle (the three points where the circle is touching the polygon).
A private helper function to find the adjacent full path for the given path segment, considering the current path segment is a starting segment (or one inside a loop).
The total set of available path segments.
A tracker to determine which segments have already been visited.
The index of the current segments to find the containing path for.
The epsilon to use to determine 'equal' path points. Must be >= 0.
The dected path which consists at least of the current path segment.
Run a path detection on the given set of path segments.
Note that the array and some path segments may be altered (like reversal) IN PLACE.
The total set (array) of available path segments.
(optional) An epsilon to use to tell if two plane points should be considered 'equal'.
An array containing all detected path (consisting of adjacent path segments of the original set).
Find all intersecting lines (indices) on the polyon that intersect the circle.
The polygon to detect the intersections on (here this is the convex hull given).
The circle to detect the intersections with.
The indices of those lines that intersect (or touch) the circle.
In an array of vertices find the first occurence of a specific vertex, using and epsilon tolerance.
The vertex array to search in.
A vertex/position to search for. This can be any x-y-tuple and does not necessarily need to be an instance of Vertex.
The epsilon tolerance to use (should be >= 0). This is a required param to avoid excessive is-undef checking if this function runs in a loop.
Get the next adjacent path segment to the given (current) segment. This is a private helper function.
Note that the function will revert the adjacent path segment if required, so the next starting point 'equals' the current ending point.
The visitation tracker will be updated if the adjacent segment was found.
The total set of available path segments (visited and invisited).
A tracker of visited path segments so far.
The current path segment to find the adjacent segment for.
The epsilon to use to detect 'equal' start/end points. Must be >= 0.
The next adjacent path segment of null if no such exists.
Contrast color algorithm by Martin Sojka's. Found at https://gamedev.stackexchange.com/questions/38536/given-a-rgb-color-x-how-to-find-the-most-contrasting-color-y/38542#38542
Internal helper function used to get 'float' properties from elements. Used to determine border withs and paddings that were defined using CSS.
This function computes the three points for the inner maximum circle lying tangential to the three subsequential lines (given by four points).
Compute the circle from that triangle by using Triangle.getCircumcircle().
Not all three lines should be parallel, otherwise the circle might have infinite radius.
LineA := [vertA, vertB] LineB := [vertB, vertC] LineC := [vertC, vertD]
The first point of the three connected lines.
The second point of the three connected lines.
The third point of the three connected lines.
The fourth point of the three connected lines.
The triangle of the circular tangential points with the given lines (3 or 4 of them).
Ported to typescript.
A private helper function that initializes the visitation tracking and reverses dangling path ends to connect them with preceding paths.
Note that this function alters those dangling path segments IN PLACE!
Find the next unvisited path segment (private helper function).
There is a special order: starting path segments (those without any predecessor) will be preferred. If no more open paths are available (no starting path segments), then no more unvisited paths are available or all remaining paths are loops (without determined start/end).
Doing this keeps us from the need to run a final loop to connect detected sub paths.
The path segments to search in.
The index of the next unvisited path segment or -1 if no more are available.
A matrix-fill helper function. Equivalent of lodash.array_fill(...).
Transform the given path data (translate and scale. rotating is not intended here).
An array of straight line segments (Line) or curve segments (CubicBezierCurve) representing the path.
A helper function to shuffle the colors into a new order.
The SVG path data to split. This should be some string
A collection of usefull geometry utilities.
Compute the n-section of the angle – described as a triangle (A,B,C) – in point A.
The first triangle point.
The second triangle point.
The third triangle point.
The number of desired angle sections (example: 2 means the angle will be divided into two sections, means an returned array with length 1, the middle line).
An array of n-1 lines secting the given angle in point A into n equal sized angle sections. The lines' first vertex is A.
Wrap the value (e.g. an angle) into the given range of [0,max).
The value to wrap.
The max bound to use for the range.
The wrapped value inside the range [0,max).
Wrap the value (e.g. an angle) into the given range of [min,max).
The value to wrap.
The min bound to use for the range.
The max bound to use for the range.
The wrapped value inside the range [min,max).
Generated using TypeDoc
The types that can be drawn and thus added to the draw queue.