{"id":13692794,"url":"https://github.com/CAIMEOX/VoxelGeometry","last_synced_at":"2025-05-02T19:32:38.409Z","repository":{"id":50631518,"uuid":"519669622","full_name":"CAIMEOX/VoxelGeometry","owner":"CAIMEOX","description":"Voxel geometry structure generator","archived":false,"fork":false,"pushed_at":"2024-04-04T14:55:54.000Z","size":3236,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"core","last_synced_at":"2025-04-04T01:32:22.170Z","etag":null,"topics":["canvas","chaos-game","diffusion-limited-aggregation","fractal","function-programming","geometry","iterated-function-system","lsystem","turtle-graphics","voxel","voxel-generator"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CAIMEOX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-07-31T03:18:53.000Z","updated_at":"2024-12-28T09:17:42.000Z","dependencies_parsed_at":"2024-04-12T23:28:14.638Z","dependency_job_id":"afb00532-682e-4be8-aa0e-ab6ffcf8f57d","html_url":"https://github.com/CAIMEOX/VoxelGeometry","commit_stats":{"total_commits":114,"total_committers":5,"mean_commits":22.8,"dds":"0.42105263157894735","last_synced_commit":"8bed472756c8d88c472aff650543d114139c366e"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAIMEOX%2FVoxelGeometry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAIMEOX%2FVoxelGeometry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAIMEOX%2FVoxelGeometry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAIMEOX%2FVoxelGeometry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CAIMEOX","download_url":"https://codeload.github.com/CAIMEOX/VoxelGeometry/tar.gz/refs/heads/core","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252095452,"owners_count":21693919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["canvas","chaos-game","diffusion-limited-aggregation","fractal","function-programming","geometry","iterated-function-system","lsystem","turtle-graphics","voxel","voxel-generator"],"created_at":"2024-08-02T17:01:02.083Z","updated_at":"2025-05-02T19:32:37.961Z","avatar_url":"https://github.com/CAIMEOX.png","language":"TypeScript","funding_links":[],"categories":["Tool (Create)"],"sub_categories":["World"],"readme":"# \u003ccenter\u003eVoxel Geometry\u003c/center\u003e\n\n![logo](./gallery/logo.png)\n\nVoxel Geometry is voxel geometry library which is used to construct **Space** (A collection of 3-dimension Vectors) and perform **transformation** between Spaces.\n\nA voxel represents a value on a regular grid in three-dimensional space. Geometry means this software is very **mathematically** and owns more features as follows for generating awesome structures.\n\n-   **Basic Geometry** : Sphere, circle, cylinder, torus, line and more.\n-   **Lindenmayer system** (**L-System**) : A parallel rewriting system. The recursive nature of the L-system rules leads to self-similarity and thereby, fractal-like forms are easy to describe with an L-system.\n-   **Turtle Graphic** : Full features and extensions of turtle graphics.\n-   **Transformer** : Transforming space into another by pipe, compose, scale, diffusion and more.\n-   **Expression drawing** : Constructing from math expression or parametric equation.\n-   **Canvas API** : Javascript browser graphics API support.\n-   **Linear and Nonlinear Transform** : Mapping space into another one.\n-   **Diffusion Limited Aggression** : Simulating particles undergoing a random walk due to Brownian motion cluster together to form aggregates of such particles.\n-   **Chaos Theory** : Iterated Function System which uses Chaos Game.\n\n## Application\n\nYou can check the branches for the Application of this library in Minecraft.\n\n-   **core** : Voxel Geometry core\n-   **ws** : Voxel Geometry for Minecraft Bedrock (Based on Websocket server)\n-   **gt** : Voxel Geometry for Minecraft Bedrock (Based on Gametest framework)\n-   **webviewer** : Voxel Geometry Web Viewer\n\n## Screenshots\n\nCheck the [gallery folder](https://github.com/CAIMEOX/VoxelGeometry/tree/webviewer/gallery#readme) for more information.\n\n## Installation\n\n```bash\nnpm i @pureeval/voxel-geometry\n```\n\n## Basic Concepts\n\n### Vector\n\nA vector represent a voxel in the Space, which has 3 components.\n\n```js\n// Create a unit vector\nconst vec: Vec3 = vec3(1, 1, 1);\n```\n\n### Space\n\nMany Voxel Geometry functions will return a **Space** (A array of 3D vectors).\n\n```ts\nconst ball: Space = sphere(5, 4);\n```\n\n## Basic Geometry\n\n### Sphere\n\nCreate a sphere with radius.\n\n```haskell\nsphere :: (radius, inner_radius) -\u003e Space\nsphere(5,4)\n```\n\n### Circle\n\nCreate a circle with radius.\n\n```haskell\ncircle :: (radius, inner_radius) -\u003e Space\ncircle(5, 4)\n```\n\n### Torus\n\nCreate a torus.\n\n```haskell\ntorus :: (radius, ring_radius) -\u003e Space\ntorus(10,8)\n```\n\n## Transformer\n\n### scale\n\nScale up a Space\n\n```haskell\nscale :: (Space, size) -\u003e Space\n```\n\n### swap\n\nChange the direction of a space.\n\n```haskell\nswap :: (Space, number, number) -\u003e Space\n```\n\n### pipe\n\nTake the point of the previous space as the origin of the next space.\n\n```haskell\npipe :: (Space_1, Space_2, ...) -\u003e Space\n```\n\n### diffusion\n\nSpread out points of a space by a factor.\n\n```haskell\ndiffusion :: (Space, factor) -\u003e Space\n```\n\n### move\n\nMove a space into a specific point.\n\n```haskell\nmove :: (Space, x, y, z) -\u003e Space\n```\n\n### embed\n\nEmbed a space into another space\n\n```haskell\nembed :: (Space, Space) -\u003e Space\n```\n\n### Array Generator\n\nConstruct a discrete set of points.\n\n```haskell\narray_gen :: (xn, yn, zn, dx, dy, dz) -\u003e Space\n```\n\n-   \\_n : Count\n-   d\\_ : Interval\n\nWith step function:\n\n```haskell\narray_gen_fn :: (xn, yn, zn, num -\u003e num, num -\u003e num, num -\u003e num) -\u003e Space\n```\n\n## Turtle\n\n### Turtle2D\n\nTurtle graphics are vector graphics using a relative cursor (the \"turtle\") upon a Cartesian plane (x and y axis).\n\nVoxel Geometry supports basic functions of turtle graphics:\n\n```javascript\n// Draw a straight with length 10\nconst t = new Turtle2D();\nt.forward(10);\nplot(t.getTrack());\n```\n\n### Turtle3D\n\nSame as Turtle2D but lives in 3D space.\n\n## L-System\n\nAn L-system or Lindenmayer system is a parallel rewriting system and a type of formal grammar.It consists of an **alphabet**, a collection of **production rules** that expand each symbol into some larger string of symbols, an initial \"**axiom**\" string from which to begin construction, and a **mechanism** (Such as Turtle Graphics) for translating the generated strings into geometric structures.\n\nIn Voxel Geometry, you can use this function to create a Bracketed L-system:\n\n```haskell\nlsystem :: (axiom, Rules, generation) -\u003e Space\n```\n\nFor instance, we can create Peano curve by using l-system.\n\n```javascript\nlsystem(\n\t'X',\n\t{\n\t\tX: 'XFYFX+F+YFXFY-F-XFYFX',\n\t\tY: 'YFXFY-F-XFYFX+F+YFXFY'\n\t},\n\t5\n);\n```\n\nVoxel Geometry uses Turtle Graphics as default mechanism.\n\n## Canvas\n\nVoxel geometry supports a part of Canvas API in browser.\n\n## Math Interpreter\n\n### Parametric Equation\n\nParametric equations are commonly used to express the coordinates of the points that make up a geometric object such as a curve or surface. It includes group of quantities as functions of one or more independent variables called **parameters**.\n\nFor instance, we could write down the Parametric equations of ellipse. (t is the parameter, which varies from 0 to 2\\*Pi)\n\n```javascript\n// a and b are constants\nx = a * cos(t);\ny = b * sin(t);\n```\n\nExpress this in Voxel Geometry (step represent the changing value of the parameter):\n\n```javascript\nlet step = 0.1;\nplot(simple_parametric('5*Math.cos(t)', '0', '10*Math.sin(t)', ['t', 0, Math.PI * 2, step]));\n```\n\n### Expression\n\nTakes a math expression (Such as inequality) as a condition and intervals, construct a space satisfies this:\n\n```haskell\nsimple_equation :: (Expr, start, end, step) -\u003e Space\n```\n\nFor instance we can construct a sphere:\n\n```javascript\nplot(simple_equation('x*x+y*y+z*z\u003c=5', -5, 5, 1));\n```\n\n## Diffusion Limited Aggression\n\nSimulating particles undergoing a random walk due to Brownian motion cluster together to form aggregates of such particles.\n\n### DLA2D\n\n```haskell\nDLA2D :: (width, maxWalk, iterations, stepLength, temperature, stuckSpace = centerPoint) -\u003e Space\n```\n\n-   width : Width of operation space.\n-   maxWalk : Maximum number of particles that can exist simultaneously.\n-   iterations : Determine how many times before each particle supplement.\n-   stepLength : Step size of particles.\n-   temperature : The temperature of the iterative system will gradually decrease, which is related to the number of subsequent replenishment points.\n-   stuckSpace : A collection of particles that have been fixed at the beginning.\n\n### DLA3D\n\nSame as DLA2D but lives in 3D space.\n\n```haskell\nDLA3D :: (width, maxWalk, iterations, stepLength, temperature, stuckSpace = centerPoint) -\u003e Space\n```\n\n## Iterated Function System\n\nAn iterated function system is a finite set of mappings on a complete metric space. Iterated function systems (IFSs) are a method of constructing **fractals**.\n\nVoxel Geometry uses the classic algorithm named **Chaos Game** to compute IFS fractals.\n\nVoxel Geometry uses the representation introduced in [this website](https://cs.lmu.edu/~ray/notes/ifs/)\n\nBy convention an IFS is written in rows of numbers in the form :\n\n```\na    b    c    d    e    f    p\n```\n\nwhich describes the transform `λ(x,y).(ax+by+e,cx+dy+f)`. The value p represents the percentage of the fractal's area generated by the transform. Theoretically it is not required but if you select it well, the fractal is drawn much more efficiently.\n\n```haskell\ncreate_IFS :: (form, width, height) -\u003e IFS\n```\n\nHere is a classic to try:\n\n```javascript\n// Create an IFS with Fractals.angle, 100000 iteration\nplot(create_IFS(Fractals.angle, 100, 100).run(100000));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCAIMEOX%2FVoxelGeometry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCAIMEOX%2FVoxelGeometry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCAIMEOX%2FVoxelGeometry/lists"}