Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma target fte
- // ========================================================
- // SUNDRY MATHS FUNCTIONS ********************************
- // ========================================================
- // Convert Cartesian Coordinates to Texture Coordinates
- // --------------------------------------------------------
- vector(vector Size, vector Cartesian) ToTexCoords =
- {
- return [Cartesian_x / Size_x, Cartesian_y / Size_y];
- };
- // --------------------------------------------------------
- // Convert RGB to QC Colours
- // --------------------------------------------------------
- vector(vector rgb) ToQCColours =
- {
- return [rgb_x / 256, rgb_y / 256, rgb_z / 256];
- };
- // --------------------------------------------------------
- // Convert QC to RGB Colours
- // --------------------------------------------------------
- vector(vector rgb) ToRGBColours =
- {
- return [rgb_x * 256, rgb_y * 256, rgb_z * 256];
- };
- // --------------------------------------------------------
- // Get distance between points
- // --------------------------------------------------------
- float(vector A, vector B) GetDistance =
- {
- float deltaX = A_x - B_x;
- float deltaY = A_y - B_y;
- return sqrt((deltaX*deltaY)+(deltaY*deltaY));
- };
- // --------------------------------------------------------
- // Orbit a poit radially
- // --------------------------------------------------------
- vector(vector Origin, float Radius, float Angle) OrbitPoint =
- {
- float xposition = Radius * cos(Angle);
- float yposition = Radius * sin(Angle);
- vector result;
- result_x = xposition + Origin_x;
- result_y = yposition + Origin_y;
- return result;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement