Author Topic: Axolotl attempts to make a script by reverse engineering another one.  (Read 1892 times)

From Scratch to TorqueScript. http://scratch.mit.edu/projects/SeanCanoodle/1747215



It'll be easy to do. Also, it's a basic cubic interpolation function, easily convertible into TorqueScript.

Making it bicubic will be a little difficult. I'll work on this stuff tomorrow.
« Last Edit: November 28, 2012, 11:46:03 PM by Axolotl2 »

Scratch is only good for kids, proof of concepts for kids, and making a layout for code
« Last Edit: November 28, 2012, 11:47:41 PM by Brian Smithers »

Scathing is only good for kids, proof of concepts for kids, and making a layout for code
I didn't make the script, though.

Oh my gosh, that's Scratch? I screwed around with that, before.

I didn't make the script, though.
Oh
Wait you want to convert that to TS?

Oh
Wait you want to convert that to TS?
I do, after I find out how to make it bicubic.
Oh my gosh, that's Scratch? I screwed around with that, before.
I learned a tiny bit of trig from it by simply screwing with a "change i by 1" loop and a graph script I made.

A bulb appeared above my head!

Code: [Select]
x01 x02 x03 x04
x05 x06 x07 x08
x09 x10 x11 x12
x13 x14 x15 x16

I have 16 variables located in integer X and Y positions. 4 cubic interpolation curves through the X axis will be generated. The first one goes through 01-04, second 05-08, third 09-12, fourth 13-16. Curves through the Y axis will cubicly interpolate between the 4 curves' points.

I'd call this weaved bicubic interpolation, but this is probably not real bicubic interpolation. Somebody can correct me if I am incorrect.

They make us use Scratch at school, it's terrible.

i need to use scratch for my GCSE so naturally im going to ace this subject, stuff is so easy

i need to use scratch for my GCSE so naturally im going to ace this subject, stuff is so easy
I thought you were much older and you went to college for some reason.

Ahhh I used to love Scratch.

I thought you were much older and you went to college for some reason.

I'm going to school for a CS major right now and intro computer science is still this easy. We were just using alice to understand objects. I mean the pace is really nice because it allows you to fully understand things but I imagine it gets a lot faster once im out of the Gen ed class

I have finished my cubic interpolation script. If anybody wants to use it for a terrain generator, then here you go:
Code: [Select]
//----------PROJECT: Resources for coding
//----------AUTHOR: SeanCanoodle
//----------PORTER: Axolotl (BL_ID 32440)
//----------SCRIPT: Cubic Interpolation
// Cubic interpolation algorithm made by SeanCanoodle of scratch.mit.edu
// http://scratch.mit.edu/projects/SeanCanoodle/1747215
//
// THIS SCRATCH TO TORQUESCRIPT PORT IS LICENSED UNDER:
// Creative Commons Attribution-ShareAlike 2.0 Generic (http://creativecommons.org/licenses/by-sa/2.0/deed.en)
// You may change this script and distribute it as long as you put this information on your project, and agree to the terms of this license.


function CubicInterpolate( %x1 , %x2 , %x3 , %x4 , %width ) //Returns a spaced list of numbers that are cubic interpolated.
{
    for( %i = 0 ; %i <= %width ; %i++ )
    {
        %mu = ( 1 / %width ) * %i;
        %mu2 = %mu * %mu;
        
        %a0 = ( ( %x3 - %x2 ) - %x0 ) + %x1;
        %a1 = ( %x0 - %x1 ) - %a0;
        %a2 = %x2 - %x0;
        %a3 = %x1;
        
        %y3y2 = ( ( %a0 * %mu) * %mu2 )  + ( %a1 * %mu2 ); //calculate ax3 + bx2
        %y1y0 = ( %a2 * %mu ) + %a3; //calculate cx + d
        %result = %y3y2 + %y1y0; //now do (ax3 + bx2) + (cx + d)
        
        %real = %real SPC %result; //concatenate every y value
    }
    return %real; //return concatenated y values
}

ooh looks nice. I don't think I have any use for this right now though.