summaryrefslogtreecommitdiff
path: root/tests/unit_tests/test305_Moebius/Moebius.sci
diff options
context:
space:
mode:
authorSiddhesh Wani2015-05-25 14:46:31 +0530
committerSiddhesh Wani2015-05-25 14:46:31 +0530
commitdb464f35f5a10b58d9ed1085e0b462689adee583 (patch)
treede5cdbc71a54765d9fec33414630ae2c8904c9b8 /tests/unit_tests/test305_Moebius/Moebius.sci
downloadScilab2C_fossee_old-db464f35f5a10b58d9ed1085e0b462689adee583.tar.gz
Scilab2C_fossee_old-db464f35f5a10b58d9ed1085e0b462689adee583.tar.bz2
Scilab2C_fossee_old-db464f35f5a10b58d9ed1085e0b462689adee583.zip
Original Version
Diffstat (limited to 'tests/unit_tests/test305_Moebius/Moebius.sci')
-rw-r--r--tests/unit_tests/test305_Moebius/Moebius.sci66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/unit_tests/test305_Moebius/Moebius.sci b/tests/unit_tests/test305_Moebius/Moebius.sci
new file mode 100644
index 0000000..cb598c0
--- /dev/null
+++ b/tests/unit_tests/test305_Moebius/Moebius.sci
@@ -0,0 +1,66 @@
+//SCI2C: DEFAULT_PRECISION= DOUBLE
+
+function Moebius()
+
+//the program construct moebius
+// and klein bottle surface from
+//http://www.metlin.org/mathematics/
+// topological-constructs/non-orientable-surfaces/
+
+
+// ---------------------
+// --- Moebius strip ---
+// ---------------------
+num_points = 20;
+R = 20;
+a = -0.4;
+b = 0.4;
+
+step=(b-a)./(num_points-1);
+step1=(2*%pi)./num_points;
+s=a:step:b;
+t=0:step1:2*%pi;
+
+[S, T] = XYgrid(s, t);
+x = [R + (S.*cos(T./2))].*cos(T);
+y = [R + (S.*cos(T./2))].*sin(T);
+z = S.*sin(T./2);
+
+disp('x(1:10)')
+disp(x(1:10))
+disp('y(1:10)')
+disp(y(1:10))
+disp('z(1:10)')
+disp(z(1:10))
+
+// ENABLE/DISABLE PLOT
+// scf(0); surf(x, y, z);
+
+// -----------------------
+// --- Klein Bottle II ---
+// -----------------------
+num_points = 50;
+
+//u = linspace (0, 2*(%pi), num_points);
+//v = linspace (0, 2*(%pi), num_points);
+step_u = (2*%pi)./num_points
+u = 0:step_u:2*%pi;
+v = u;
+
+[U,V] = XYgrid(u,v);
+
+x1 = cos(U).*(cos(U./2).*(sqrt(2)+cos(V))+(sin(U./2).*sin(V).*cos(V)));
+y1 = sin(U).*(cos(U./2).*(sqrt(2)+cos(V))+(sin(U./2).*sin(V).*cos(V)));
+z1 = -1.*sin(U./2).*(sqrt(2)+cos(V))+cos(U./2).*sin(V).*cos(V);
+
+disp('x1(1:10)');
+disp(x1(1:10));
+disp('y1(1:10)')
+disp(y1(1:10))
+disp('z1(1:10)')
+disp(z1(1:10))
+// ENABLE/DISABLE PLOT
+// scf(1) ;surf(x1, y1, z1)
+
+endfunction
+