Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double step = Math::PI / (arc/2);
- for (int i = 0; i < (arc/2) + 1; i++)
- {
- for (int j = 0; j < arc; j++)
- {
- double x = center->X + radius * Math::Sin(step * i) * Math::Cos(step * j);
- double y = center->Y + radius * Math::Sin(step * i) * Math::Sin(step * j);
- double z = center->Z + radius * Math::Cos(step * i);
- vertices->SetRow(arc * i + j, gcnew array<double> {x, y, z, 1});
- double u = (Mod(Math::Atan((y - center->Y)/(x - center->X)), (Math::PI * 2))) / (Math::PI * 2);
- if (x == center->X) u = 0;
- double v = (Math::PI - (Math::Acos((z - center->Z) / radius))) / Math::PI;
- texture->SetRow(arc * i + j, gcnew array<double> {u, v});
- }
- }
- for (int k = 0; k < pointNum - (arc + 1); k++)
- {
- sides->SetRow(k, gcnew array<double> {k, k + 1, k + arc});
- sides->SetRow(pointNum - (arc + 1) + k, gcnew array<double> {k + 1, k + arc, k + arc + 1});
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement