Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int i;
- double rad_angle = 0.0;
- double angle = 0.0;
- double x = 0, y = 0, z = 0;
- double radius = 10.0;
- for(i=0; i<=36; i++)
- {
- // Transform degrees in rads
- rad_angle=(pi*angle)/180.0;
- // Calculate the x and z co-ordinates of a circle ground
- x = radius/(sqrt(1.0 + tan(rad_angle)*tan(rad_angle)));
- z = radius*(sqrt(1.0 - (1.0/(1.0 + tan(rad_angle)*tan(rad_angle)))));
- angle+= 10;
- // Check the co-ordinates in all the quadrants of the circle ground
- if ((i>=0) && (i<10)) // First quadrant
- {
- if (i==9)
- {
- _points[i] = TVector(0.0, 0.0, 1.0);
- }
- _points[i] = TVector(x, y, z);
- }
- if ((i>=10) && (i<19)) // Second quadrant
- {
- _points[i] = TVector(-x, y, z);
- }
- if ((i>=19) && (i<28)) // Third quadrant
- {
- if (i==27)
- {
- _points[i] = TVector(0.0, 0.0, -1.0);
- }
- _points[i] = TVector(-x, y, -z);
- }
- if ((i>=27) && (i<=36)) // Fourth quadrant
- {
- _points[i] = TVector(x, y, -z);
- }
- }
- // Construct the vector for the normal of the ground
- _normal = TVector(0.0, 1.0, 0.0);
Add Comment
Please, Sign In to add comment