i've found this interesting page: superellipse and superellipsoid and i used the formula for one of my computer graphics applications. i used (the most usefull for computer graphics) the parametric formula:
but for correclty draw the superellipsod i had to calculate also some absolute values of sine and cosine and deal with signs like in this piece of code (it's ANSI C code, i hope it make sense for you):
void EvalSuperEllipse(double t1,double t2,double p1,double p2,XYZ *p)
{
double tmp;
double ct1,ct2,st1,st2;
ct1 = cos(t1);
ct2 = cos(t2);
st1 = sin(t1);
st2 = sin(t2);
// SIGN function return 1 if input is positive, -1 if it is negative
// fabs function calculate absolute value
tmp = SIGN(ct1) * pow(fabs(ct1),n1);
p->x = tmp * SIGN(ct2) * pow(fabs(ct2),n2);
p->y = SIGN(st1) * pow(fabs(st1),n1);
p->z = tmp * SIGN(st2) * pow(fabs(st2),n2);
}
the first question is how to write in pure math formalism the parametric formula including those sign change (obtained with SIGN and fabs function), and the second question is why i have to make this manipulations and how understand that i had to do that in new geometric adventure if i don't find the code ready-to-use.
i hope i do not make an off-topic with this programming question! (i know it's weird to post ANSI C code here but i think is more attinent here instad of in stackoverflow.com)