Code covered by the BSD License
-
...
CREATEINNERBARS Creates the bars of the inner (blue) ring
-
...
CREATEOUTERBARS Creates the red motionless supporting bar
-
EuMat( phi, theta, psi )
EUMAT returns a rotation matrix rotating an object by the Cardan angles
-
cylinderWeights(r1,r2)
CYLINDERWEIGHTS creates the innermost blue bars with heavy looking cylinders
-
multiplyEuMat( EuMat, X,Y,Z )
MULTIPLYEUMAT takes the X, Y, Z coordinates of an object and returns the
-
sTopMain(fileToRead)
STOPMAIN Plots an animated spinning top with Cardan mounting from raw
-
torus (a, n, r, kpi)
TORUS Generate a torus.
-
sTopEuler.m
-
View all files
from
animated spinning top with Cardan mounting
by Alexander Erlich
Plots an animated spinning top with Cardan mounting from raw animation data.
|
| torus (a, n, r, kpi) |
function [x, y, z] = torus (a, n, r, kpi)
% TORUS Generate a torus.
% torus (r, n, a, kpi) generates a plot of a
% torus with central radius a and
% lateral radius r.
% n controls the number of facets
% on the surface.
% kpi makes it possible to draw a whole torus,
% or e.g. half of it.
%
% This script is a modification of a
% program from:
% MATLAB Primer, 6th Edition
% Kermit Sigmon and Timothy A. Davis
% Section 11.5, page 65.
theta = -pi * (0:2:kpi*n)/n ;
phi = 2*pi* (0:2:n)'/n ;
x = (a + r*cos(phi)) * cos(theta) ;
y = (a + r*cos(phi)) * sin(theta) ;
z = r * sin(phi) * ones(size(theta)) ;
|
|
Contact us at files@mathworks.com