|
JavaScript Map Function with Interpolatable Curves (Composition by dust)
here is a javascript interpolator or mapping function. it doesn't have its own time base as this is just to scale numbers. so it will not generate but it does map. why do you need this if apple interpolator works fine. maybe your inquisitive like i am as i seem to do a lot of interpolating plus the curve feature is exposed so you can interpolate a curve overtime. does that make since interpolate your interpolator curve ? well maybe you want ease out or in a little longer for a specific period of time or more or less than you can draw a cubic or quadratic curve etc... if you set the curve to zero it is linear. so ironically i'm using an interpolator to generate a range of 0-127 integers so i can map that range down to a -1 to 1 float range with some simple javascript logic based on powers of 10. im thinking i will do a javascript smooth later with its own time base so it will smooth and generate numbers ? maybe a hermite interpolator or something is not in QC. paul bourke has lots of wonderful interpolation examples on his site is this stuff interests you. |
Hey dust, did you know you can output from the JS patch to an interpolator and then input the result of interpolator back into the JS patch. Kind of like an external map function call, but you can draw your own graph in the settings panel (or use std quad, cubic, sin with tension etc).
Can't remember what I used it for but I was exploring feedback amongst various patches and what happens when a patch eats-itself. TO use a PoP analogy.
yeah i like doing recursive feedback functions as well. some people have a real hard time with recursion i found it easier to grasp than some other types of lets say sorting methods or graph traversals etc..
recursions funny look it up in the dictionary it says. "see recursion"
basically i explain recursion as finite components used to define an infinite statement defined within itself like this code.
well its late im being to lazy to check or compile this arbitrary function to make sure its infinite... if you have no idea whats going (see recursion) just kidding. this function is normally bad as it never hits its base.
if you still don't get see recursion.
that jokes only funny till someone gets it.
Sounds intriguing. Looking forward to trying this later (and your Trackball one, too).
Paul Bourke is a Curves Guru- I've been mining his site for a couple of years now :D
a|x
I'll pay that, dust. Who's writing your material, dude?
I got a max call stack exceeded error in QC JS with that code btw!
That's a nice script, here's how it works with some Mesh macros I whipped up.
They can be found in the Composition Repository.
Uses TaffGoch's GeorgeHart.dae
yeah that was me who wrote that. it was another recursion joke, as that code keeps pushing to the stack because it returns the same thing you put in meaning if x=recursion it returns recursion. QC says NO infinite loop stack overflow.
actually doing augmented or tail recursion sometimes forces the compiler to allocate constant heap space instead of stacking every iteration which qc js seems to like.
yeah the geodesic model looks nice at first i plopped in a model of mr. brainwash i'm working on for a game and it didn't look as nice as the dome but did have a cool mesh x-ray. i have been meaning to investigate your new mesh files in the repository and comment. its not till this week that i'm working with some dae exports. actually i have been thinking about mesh iteration and hit testing lately as i have been using inertia momentum and forces as of late but want to see about making some sort of little physics engine rigid body kind of thing. so pretty soon once all my models are done i will be taking a closer look at your mesh iterations.