Guest User

Untitled

a guest
Jun 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. int i;
  2. double rad_angle = 0.0;
  3. double angle = 0.0;
  4. double x = 0, y = 0, z = 0;
  5. double radius = 10.0;
  6.  
  7. for(i=0; i<=36; i++)
  8. {
  9. // Transform degrees in rads
  10. rad_angle=(pi*angle)/180.0;
  11. // Calculate the x and z co-ordinates of a circle ground
  12. x = radius/(sqrt(1.0 + tan(rad_angle)*tan(rad_angle)));
  13. z = radius*(sqrt(1.0 - (1.0/(1.0 + tan(rad_angle)*tan(rad_angle)))));
  14. angle+= 10;
  15.  
  16. // Check the co-ordinates in all the quadrants of the circle ground
  17. if ((i>=0) && (i<10)) // First quadrant
  18. {
  19. if (i==9)
  20. {
  21. _points[i] = TVector(0.0, 0.0, 1.0);
  22. }
  23. _points[i] = TVector(x, y, z);
  24. }
  25. if ((i>=10) && (i<19)) // Second quadrant
  26. {
  27. _points[i] = TVector(-x, y, z);
  28. }
  29. if ((i>=19) && (i<28)) // Third quadrant
  30. {
  31. if (i==27)
  32. {
  33. _points[i] = TVector(0.0, 0.0, -1.0);
  34. }
  35. _points[i] = TVector(-x, y, -z);
  36. }
  37. if ((i>=27) && (i<=36)) // Fourth quadrant
  38. {
  39. _points[i] = TVector(x, y, -z);
  40. }
  41. }
  42. // Construct the vector for the normal of the ground
  43. _normal = TVector(0.0, 1.0, 0.0);
Add Comment
Please, Sign In to add comment