Chatting like it's 1999! An open forum to discuss Hexcasting, and anything else made by petrak@'s mods, and also anything else else https://forum.petra-k.at/
Calculates a point on a Bezier curve given a list of control points and a number between 0 and 1. Uses as many meta-eval levels as there are control points.
An example is below. It was produced by casting Counter's Queue 50, mapping it to Bezier(i/50) with Thoth, and casting Particles on the resulting list.
#define Bezier's Distillation (NORTH_EAST eeeqqq) = [vec], num -> vec
// P, t -> B(t), where 0 <= t <= 1
// meta-eval: len(P)
{
Muninn's Reflection
Rotation Gambit II
// find n and n+1
Jester's Gambit
Gemini Decomposition
Abacus Purification
Gemini Decomposition
Numerical Reflection: 1
Subtractive Distillation // P contains n+1 vectors, so subtract 1 from len(P)
Rotation Gambit II
// zip indices and control points
Perfect Counter's Queue
Jester's Gambit
Numerical Zipper Distillation
// calculate the summation
{
// unzip index and control point
Flock's Disintegration
Vector Exaltation
// n-i
Rotation Gambit II
Dioscuri Gambit
Subtractive Distillation
// nCi
Rotation Gambit II
Undertaker's Gambit
Binomial Distillation
// t^i
Rotation Gambit II
Numerical Reflection: 5
Fisherman's Gambit
Undertaker's Gambit
Jester's Gambit
Power Distillation II
// (1-t)^(n-i)
Rotation Gambit II
Numerical Reflection: 1
Jester's Gambit
Subtractive Distillation
Jester's Gambit
Power Distillation II
// add (nCi * t^i * (1-t)^(n-i) * P) to the running total
Multiplicative Distillation
Multiplicative Distillation
Multiplicative Distillation
Vector Reflection Zero
Muninn's Purification
Additive Distillation
Huginn's Gambit
}
Jester's Gambit
Thoth's Gambit
Bookkeeper's Gambit: vvv
Muninn's Reflection
Jester's Gambit
Huginn's Gambit
}
Re: Macro Megathread
Posted: Mon May 22, 2023 5:24 pm
by beholderface
Angular Distillation vec, vec → num
Takes two vectors and returns the angle between them, in radians. To find the plane that this angle is on, just use the cross product of the two vectors.
EDIT: This does not tell you which direction you'd need to rotate a vector in in order to match another vector.
Quinio [pattern] →
loops a pattern list forever and hides itself in the execution stack
loop can be broken by using flow control in the input function Patterns
Thoth's padded cell [pattern] → [any],any
Executes a pattern list like Hermes, but also uses Thoth's own stack, and its own ravenmind as well. Pushes the resulting ravenmind and restores the original after executing the pattern list. Useful for dealing with multiple hex pieces that interact with the ravenmind and stack in an obtrusive way, and can be nested. Patterns
vacillate vec, vec →
macro for a wisp to constantly travel between two positions
the hex looks a bit weird but basically it's first checking whether it has a destination, if it does the second conditional will just return that. If it doesn't it will compare the wisp's position to the second vector input and will decide a destination based on that. Patterns
tour [vec] →
Takes a list of vectors and makes the wisp move through each of them, looping back to the first when it reaches the last position in the list.
Uses a similar conditional structure, except of course finding which position it needs to go to in the list instead of switching. Patterns
Searchlight Exaltation vec, vec, [entity] → entity
Takes position, a direction, and a list of entities. Finds the entity of which the vector from the given position to it has the smallest angle with the unit vector.
To give an example in the style of the book, if I used my position and my look direction, and a list of all entities excluding me, which entity would be closest to my crosshair? (as you might guess it's very useful for making aim assist)
Mishaps if one of the entities in the list is exactly at the given position. Patterns