Skip to content

Instantly share code, notes, and snippets.

@aoisensi
Created September 7, 2012 09:43
Show Gist options
  • Save aoisensi/3664701 to your computer and use it in GitHub Desktop.
Save aoisensi/3664701 to your computer and use it in GitHub Desktop.
Donut
const double uwaa = 100;
const double uwaaa = 50;
const int www = 5;
for(int i=-www;i<www;++i)
{
for(int j=-www;j<www;++j)
{
ILVECTOR a, b, c, d;
a = ILVECTOR(uwaa*IL::ILMath::Cos(i/www*M_PI) + uwaaa*IL::ILMath::Cos(i/www*M_PI)*IL::ILMath::Cos(j/www*M_PI), uwaaa*IL::ILMath::Sin(j/www), uwaa*IL::ILMath::Sin(i/www*M_PI) + uwaaa*IL::ILMath::Sin(i/www*M_PI)*IL::ILMath::Sin(j/www*M_PI));
b = ILVECTOR(uwaa*IL::ILMath::Cos((i+1)/www*M_PI) + uwaaa*IL::ILMath::Cos((i+1)/www*M_PI)*IL::ILMath::Cos(j/www*M_PI), uwaaa*IL::ILMath::Sin(j/www), uwaa*IL::ILMath::Sin((i+1)/www*M_PI) + uwaaa*IL::ILMath::Sin((i+1)/www*M_PI)*IL::ILMath::Sin(j/www*M_PI));
c = ILVECTOR(uwaa*IL::ILMath::Cos(i/www*M_PI) + uwaaa*IL::ILMath::Cos(i/www*M_PI)*IL::ILMath::Cos((j+1)/www*M_PI), uwaaa*IL::ILMath::Sin((j+1)/www), uwaa*IL::ILMath::Sin(i/www*M_PI) + uwaaa*IL::ILMath::Sin(i/www*M_PI)*IL::ILMath::Sin((j+1)/www*M_PI));
d = ILVECTOR(uwaa*IL::ILMath::Cos((i+1)/www*M_PI) + uwaaa*IL::ILMath::Cos((i+1)/www*M_PI)*IL::ILMath::Cos((j+1)/www*M_PI), uwaaa*IL::ILMath::Sin((j+1)/www), uwaa*IL::ILMath::Sin((i+1)/www*M_PI) + uwaaa*IL::ILMath::Sin((i+1)/www*M_PI)*IL::ILMath::Sin((j+1)/www*M_PI));
Space.AddSurface(ILTSURFACE(ILSURFACE(a,b,c),1.0F,ILCOLOR(255,0,0),1));
Space.AddSurface(ILTSURFACE(ILSURFACE(b,c,d),1.0F,ILCOLOR(255,0,0),1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment