1 |
{ RCSid $Id$ } |
2 |
{ |
3 |
Calculate superellipsoid surface |
4 |
using parametric formulation taken |
5 |
from Wikipedia |
6 |
|
7 |
12/6/2013 G. Ward |
8 |
|
9 |
Input parameters: |
10 |
A - Radius in X-direction |
11 |
B - Radius in Y-direction |
12 |
C - Radius in Z-direction |
13 |
e - 2/r parameter |
14 |
n - 2/t parameter |
15 |
|
16 |
Example: |
17 |
gensurf mat name 'x(s,t)' 'y(s,t)' 'z(s,t)' 50 50 \ |
18 |
-e 'A:1;B:1.5;C:2;e:.5;n:.7' -f superellipsoid.cal |
19 |
} |
20 |
ap(x,m) : if(x, x^m, if(-x, -(-x^m), 0)); |
21 |
fc(w,m) : ap(cos(w),m); |
22 |
fs(w,m) : ap(sin(w),m); |
23 |
|
24 |
x(s,t) = A * fc(t*PI-PI/2, n) * fc(s*2*PI-PI, e); |
25 |
y(s,t) = B * fc(t*PI-PI/2, n) * fs(s*2*PI-PI, e); |
26 |
z(s,t) = C * fs(t*PI-PI/2, n); |