Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03k
1# path-data-parser2 3I know there are a bunch of SVG path parsers out there, but here's one that I have been using for a few years now. It's small, tree-shakable and provides four simple functions that I have needed in several graphics projects.4 5## Install6 7From npm8 9```10npm install --save path-data-parser11```12 13The code is shipped as ES6 modules. 14 15## Methods16 17The module exposes 4 methods18 19### pasrePath(d: string): Segment[]20 21This is the main method that parses the SVG path data. You pass in the path string and it returns an array of `Segments`. A segment has a `key` which is the commands, e.g. `M` or `h` or `C`; and `data` which is an array of numbers used by the command22 23```javascript24Segment {25 key: string;26 data: number[];27}28```29 30example:31 32```javascript33import { parsePath } from 'path-data-parser';34const segments = parsePath('M10 10 h 80 v 80 h -80 C Z');35```36 37### serialize(segments: Segment[]): string38 39This is essentially the opposite of the `parsePath` command. It outputs a path string from an array of `Segment` objects.40 41```javascript42import { parsePath, serialize, absolutize } from 'path-data-parser';43 44const segments = parsePath('M10 10 h 80 v 80 h -80 Z');45const absoluteSegments = absolutize(segments); // Turns relative commands to absolute46const outputPath = serialize(absoluteSegments);47console.log(outputPath); // M 10 10 H 90 V 90 H 10 Z48```49 50### absolutize(segments: Segment[]): Segment[]51 52Translates relative commands to absolute commands. i.e. all commands that use relative positions (lower-case ones), turns into absolute position commands (upper-case ones).53See the `serialize` example above. 54 55### normalize(segments: Segment[]): Segment[]56 57Normalize takes a list of _absolute segments_ and outputs a list of segments with only four commands: `M, L, C, Z`. So every segment is described as move, line, or a bezier curve (cubic). 58 59This is useful when translating SVG paths to non SVG mediums - Canvas, or some other graphics platform. Most such platforms will support lines and bezier curves. It also simplifies the cases to consider when modifying these segments.60 61```javascript62import { parsePath, serialize, absolutize, normalize } from 'path-data-parser';63 64const segments = parsePath(' M 10 80 Q 52.5 10, 95 80 T 180 80');65const absoluteSegments = absolutize(segments);66const normalizedSegments = normalize(absoluteSegments);67// M 10 80 C 38.33 33.33, 66.67 33.33, 95 80 C 123.33 126.67, 151.67 126.67, 180 8068 69```70 71## License72[MIT License](https://github.com/pshihn/path-data-parser/blob/master/LICENSE)73 