Page 1 of 1

Cuboids [1.19.2]

Posted: Wed Jul 24, 2024 9:35 am
by SimplyAzgoth
I have been tinkering with a pattern to get every point in a cube around a center vec. This was a pretty cursed endeavor since the scaling iteration required easily exceeds the meta-eval cap. Alas, cuboids were in my sights no matter what. This was until I found a way to mathematically get a point on a cuboid. Now, only mass destruction of blocks awaits me and you, the reader.....

For visualization of what the cube formula does, please see my 3d desmos graph:
https://www.desmos.com/3d/y1b49krs4s

These were made for 1.19.2, so updating (or lack thereof) to 1.20.1 is best left to the reader.

PRECURSOR MACROS

Code: Select all

#define Huginn's Sandbox = any ->
{
    Vacant Reflection               // any, []
    Jester's Gambit                 // [], any
    Integration Distillation        // [any]
    Muninn's Reflection             // [any], ravenmind
    Integration Distillation        // [any, ravenmind]
    Huginn's Gambit                 // 
}

// Unsandboxes ravenmind, returning sandboxed iota. Rewrites the original back to the ravenmind
#define Muninn's Sandbox = -> any
{
    Muninn's Reflection             // [any, ravenmind]
    Flock's Disintegration          // any, ravenmind
    Huginn's Gambit                 // any
}

// Returns sandboxed iota without rewriting original back: ravenmind stays intact as before this cast
#define Muninn's Sandbox II = -> any
{
    Muninn's Reflection             // [any, ravenmind]
    Flock's Disintegration          // any, ravenmind
    Bookkeeper's Gambit: v          // any
}
These are some patterns required for ravenmind sandboxing. I got these pattern ideas from reading the macro mega thread, but I couldn't find them again so I decided to remake them. Still, credits go to whoever made them in the megathread.

Cuboid Point Exaltation

Code: Select all

// get a point in a cuboid corresponding to the certain i value where 0 <= i <= (2g+1)^3-1
// any i outside that is undefined behavior
#define Cuboid Point Exaltation = c, g, i -> vec
{
    // c, g, i
    Jester's Gambit                 // c, i, g
    Gemini Decomposition            // c, i, g, g
    Numerical Reflection: 2         // c, i, g, g, 2
    Multiplicative Distillation     // c, i, g, 2g
    Numerical Reflection: 1         // c, i, g, 2g, 1
    Additive Distillation           // c, i, g, 2g+1
    Rotation Gambit                 // c, g, 2g+1, i
    Numerical Reflection: 3
    Flock's Gambit                  // c, [g, 2g+1, i]
    Huginn's Sandbox                // c
    Vector Disintegration           // cx, cy, cz

    // vz = floor(i/(2g+1)^2) - g + cz
    Muninn's Sandbox II             // cx, cy, cz, [g, 2g+1, i]
    Flock's Disintegration          // cx, cy, cz, g, 2g+1, i
    Jester's Gambit                 // cx, cy, cz, g, i, 2g+1
    Numerical Reflection: 2
    Power Distillation              // cx, cy, cz, g, i, (2g+1)^2
    Division Distillation           // cx, cy, cz, g, i/(2g+1)^2
    Floor Purification              // cx, cy, cz, g, floor(i/(2g+1)^2)
    Jester's Gambit                 // cx, cy, cz, floor(i/(2g+1)^2), g
    Subtractive Distillation        // cx, cy, cz, floor(i/(2g+1)^2)-g
    Additive Distillation           // cx, cy, vz
    Rotation Gambit II              // vz, cx, cy

    // vy = (floor(i/(2g+1)) % (2g+1)) - g + cy
    Muninn's Sandbox II             // vz, cx, cy, [g, 2g+1, i]
    Flock's Disintegration          // vz, cx, cy, g, 2g+1, i
    Jester's Gambit                 // vz, cx, cy, g, i, 2g+1
    Gemini Decomposition            // vz, cx, cy, g, i, 2g+1, 2g+1
    Rotation Gambit II              // vz, cx, cy, g, 2g+1, i, 2g+1
    Division Distillation           // vz, cx, cy, g, 2g+1, i/(2g+1)
    Floor Purification              // vz, cx, cy, g, 2g+1, floor(i/(2g+1))
    Jester's Gambit                 // vz, cx, cy, g, floor(i/(2g+1)), 2g+1
    Modulus Distillation            // vz, cx, cy, g, floor(i/(2g+1)) % 2g+1
    Jester's Gambit                 // vz, cx, cy, floor(i/(2g+1)) % 2g+1, g
    Subtractive Distillation        // vz, cx, cy, floor(i/(2g+1)) % 2g+1 - g
    Additive Distillation           // vz, cx, vy
    Rotation Gambit II              // vy, vz, cx

    // vx = i % (2g+1) - g + cx
    Muninn's Sandbox                // vy, vz, cx, [g, 2g+1, i]
    Flock's Disintegration          // vy, vz, cx, g, 2g+1, i
    Jester's Gambit                 // vy, vz, cx, g, i, 2g+1
    Modulus Distillation            // vy, vz, cx, g, i%2g+1
    Jester's Gambit                 // vy, vz, cx, i%2g+1, g
    Subtractive Distillation        // vy, vz, cx, i%2g+1-g
    Additive Distillation           // vy, vz, vx
    Rotation Gambit II              // vx, vy, vz

    Vector Exaltation               // vec
}
Arguments
  • c = vec = Center of cuboid
    g = num = Number of blocks out from center
    i = num = Index of point to be returned
Now this pattern (or macro) will return a vec on a cuboid corresponding to its i value. Please do not make any assumptions of where this will start.

For a cuboid with g, the 'i's required to make a full cuboid with every point is [0..(2g+1)^3-1]. This is every number 0 to (2g+1)^3-1 inclusive. You would need exactly (2g+1)^3 'i's incrementing by 1 to get the full cuboid

0 <= i <= (2g+1)^3-1 must be followed otherwise undefined behavior will occur.

Uses no meta-eval only uses base hex casting.

Cuboid Exaltation

Code: Select all

#define Cuboid Exaltation = c, g -> [vec]
{
    // c, g
    Gemini Decomposition            // c, g, g
    Numerical Reflection: 2
    Multiplicative Distillation     // c, g, 2g
    Numerical Reflection: 1
    Additive Distillation           // c, g, 2g+1
    Numerical Reflection: 3
    Power Distillation              // c, g, (2g+1)^3
    Iterators Purification          // c, g, [i]
    {
        // c, g, i
        Cuboid Point Exaltation         // vec

        // delete everything on stack except top
        Flock's Reflection
        Flock's Gambit
        Retrograde Purification
        Speaker's Decomposition
        Bookkeeper's Gambit: v-         // vec
    }
    // c, g, [i], [pat]
    Jester's Gambit                 // c, g, [pat], [i]
    Thoth's Gambit                  // c, g, [vec]
    Bookkeeper's Gambit: vv-        // [vec]
}
REQUIRES HEXTWEAKS

Arguments
  • c = vec = Center of cuboid
    g = num = Number of blocks out from center
This is basically a wrapper around Cuboid Point Exaltation, where it will generate all 'i's for you and return the cuboid vecs as a list.

The only problem with this is because of the exponentially increasing 'i' required when increasing g, the meta-eval use goes through the roof. The number of evals used is (2g+1)^3.

On a clean cast (no meta-eval use beforehand), this can only handle a max 'g' of 3, and mishap due to maxed out meta-eval limit if it is above that. By no means is 3 always safe because using evals beforehand can make this maximum 'g' lower.

To get around this see applications.

APPLICATIONS (BLOCKS BE DAMMED)

Now since Cuboid Exaltation can only handle g=3 maximum, Cuboid Point Exaltation must be used generate the cuboid. But since it only generates a single point, we would need a way to cast the pattern (2g+1)^3 times....

Thats where either cyclical wisps or reverbation rod comes into play by saving the current 'i' value in the wisp's ravenmind or rod's iota container, you can act on each vec in a cuboid where g is only limited by ambit.

Now say you cast break block on each vec......
Godspeed world devourers.

Re: Cuboids [1.19.2]

Posted: Wed Jul 24, 2024 10:04 am
by SimplyAzgoth
Spaced Cuboid Point Ex.

Code: Select all

// get a point in a cuboid corresponding to the certain i value where 0 <= i <= (2g+1)^3-1. any i outside that is undefined behavior
// offset is a vector offset in each axis
#define Spaced Cuboid Point Ex. = c, g, i, offset -> vec
{
    // c, g, i, offset
    Huginn's Sandbox                // c, g, i 
    Jester's Gambit                 // c, i, g
    Gemini Decomposition            // c, i, g, g
    Numerical Reflection: 2         // c, i, g, g, 2
    Multiplicative Distillation     // c, i, g, 2g
    Numerical Reflection: 1         // c, i, g, 2g, 1
    Additive Distillation           // c, i, g, 2g+1
    Rotation Gambit                 // c, g, 2g+1, i
    Numerical Reflection: 3
    Flock's Gambit                  // c, [g, 2g+1, i]
    Muninn's Sandbox                // c, [g, 2g+1, i], offset
    Vector Disintegration           // c, [g, 2g+1, i], ox, oy, oz
    Numerical Reflection: 5
    Fisherman's Gambit              // [g, 2g+1, i], ox, oy, oz, c
    Numerical Reflection: 5
    Fisherman's Gambit              // ox, oy, oz, c, [g, 2g+1, i]
    Huginn's Sandbox                // ox, oy, oz, c
    Vector Disintegration           // ox, oy, oz, cx, cy, cz

    // vz = (floor(i/(2g+1)^2) - g)*oz + cz
    Muninn's Sandbox II             // ox, oy, oz, cx, cy, cz, [g, 2g+1, i]
    Flock's Disintegration          // ox, oy, oz, cx, cy, cz, g, 2g+1, i
    Jester's Gambit                 // ox, oy, oz, cx, cy, cz, g, i, 2g+1
    Numerical Reflection: 2
    Power Distillation              // ox, oy, oz, cx, cy, cz, g, i, (2g+1)^2
    Division Distillation           // ox, oy, oz, cx, cy, cz, g, i/(2g+1)^2
    Floor Purification              // ox, oy, oz, cx, cy, cz, g, floor(i/(2g+1)^2)
    Jester's Gambit                 // ox, oy, oz, cx, cy, cz, floor(i/(2g+1)^2), g
    Subtractive Distillation        // ox, oy, oz, cx, cy, cz, floor(i/(2g+1)^2)-g
    Numerical Reflection: 5         
    Fisherman's Gambit              // ox, oy, cx, cy, cz, floor(i/(2g+1)^2)-g, oz
    Multiplicative Distillation     // ox, oy, cx, cy, cz, (floor(i/(2g+1)^2)-g)*oz
    Additive Distillation           // ox, oy, cx, cy, vz
    Rotation Gambit II              // ox, oy, vz, cx, cy

    // vy = ((floor(i/(2g+1)) % (2g+1)) - g)*oy + cy
    Muninn's Sandbox II             // ox, oy, vz, cx, cy, [g, 2g+1, i]
    Flock's Disintegration          // ox, oy, vz, cx, cy, g, 2g+1, i
    Jester's Gambit                 // ox, oy, vz, cx, cy, g, i, 2g+1
    Gemini Decomposition            // ox, oy, vz, cx, cy, g, i, 2g+1, 2g+1
    Rotation Gambit II              // ox, oy, vz, cx, cy, g, 2g+1, i, 2g+1
    Division Distillation           // ox, oy, vz, cx, cy, g, 2g+1, i/(2g+1)
    Floor Purification              // ox, oy, vz, cx, cy, g, 2g+1, floor(i/(2g+1))
    Jester's Gambit                 // ox, oy, vz, cx, cy, g, floor(i/(2g+1)), 2g+1
    Modulus Distillation            // ox, oy, vz, cx, cy, g, floor(i/(2g+1)) % 2g+1
    Jester's Gambit                 // ox, oy, vz, cx, cy, floor(i/(2g+1)) % 2g+1, g
    Subtractive Distillation        // ox, oy, vz, cx, cy, floor(i/(2g+1)) % 2g+1 - g
    Numerical Reflection: 5
    Fisherman's Gambit              // ox, vz, cx, cy, floor(i/(2g+1)) % 2g+1 - g, oy
    Multiplicative Distillation     // ox, vz, cx, cy, (floor(i/(2g+1)) % 2g+1 - g)*oy
    Additive Distillation           // ox, vz, cx, vy
    Rotation Gambit II              // ox, vy, vz, cx

    // vx = (i % (2g+1) - g)*ox + cx
    Muninn's Sandbox                // ox, vy, vz, cx, [g, 2g+1, i]
    Flock's Disintegration          // ox, vy, vz, cx, g, 2g+1, i
    Jester's Gambit                 // ox, vy, vz, cx, g, i, 2g+1
    Modulus Distillation            // ox, vy, vz, cx, g, i%2g+1
    Jester's Gambit                 // ox, vy, vz, cx, i%2g+1, g
    Subtractive Distillation        // ox, vy, vz, cx, i%2g+1-g
    Numerical Reflection: 5
    Fisherman's Gambit              // vy, vz, cx, i%2g+1-g, ox
    Multiplicative Distillation     // vy, vz, cx, (i%2g+1-g)*ox
    Additive Distillation           // vy, vz, vx
    Rotation Gambit II              // vx, vy, vz

    Vector Exaltation               // vec
}
This pattern is the same as cuboid point distillation except that it spaces the each point by the offset vec

See this desmos for more details:
https://www.desmos.com/3d/wugntpkmus