Advertisement
Guest User

Untitled

a guest
Apr 30th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.59 KB | None | 0 0
  1. #pragma target fte
  2. // ========================================================
  3. //  SUNDRY MATHS FUNCTIONS ********************************
  4. // ========================================================
  5. // Convert Cartesian Coordinates to Texture Coordinates
  6. // --------------------------------------------------------
  7. vector(vector Size, vector Cartesian) ToTexCoords =
  8. {
  9.     return [Cartesian_x / Size_x, Cartesian_y / Size_y];
  10. };
  11. // --------------------------------------------------------
  12. // Convert RGB to QC Colours
  13. // --------------------------------------------------------
  14. vector(vector rgb) ToQCColours =
  15. {
  16.     return [rgb_x / 256, rgb_y / 256, rgb_z / 256];
  17. };
  18. // --------------------------------------------------------
  19. // Convert QC to RGB Colours
  20. // --------------------------------------------------------
  21. vector(vector rgb) ToRGBColours =
  22. {
  23.     return [rgb_x * 256, rgb_y * 256, rgb_z * 256];
  24. };
  25. // --------------------------------------------------------
  26. // Get distance between points
  27. // --------------------------------------------------------
  28. float(vector A, vector B) GetDistance =
  29. {
  30.     float deltaX = A_x - B_x;
  31.     float deltaY = A_y - B_y;
  32.     return sqrt((deltaX*deltaY)+(deltaY*deltaY));
  33. };
  34. // --------------------------------------------------------
  35. // Orbit a poit radially
  36. // --------------------------------------------------------
  37. vector(vector Origin, float Radius, float Angle) OrbitPoint =
  38. {
  39.     float xposition = Radius * cos(Angle);
  40.     float yposition = Radius * sin(Angle);
  41.     vector result;
  42.     result_x = xposition + Origin_x;
  43.     result_y = yposition + Origin_y;
  44.     return result;
  45. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement