diff options
| author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
| commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
| tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/toolbox/toolbox_basic/affine/hemisphere_s.m | |
| parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (diff) | |
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to:
- Use libextra to loop as realtime jobs
- Preallocate memory before starting their main computation
- Accept input via stdin instead of via argc
Does not include the SD-VBS matlab code.
Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/affine/hemisphere_s.m')
| -rwxr-xr-x | SD-VBS/common/toolbox/toolbox_basic/affine/hemisphere_s.m | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/affine/hemisphere_s.m b/SD-VBS/common/toolbox/toolbox_basic/affine/hemisphere_s.m new file mode 100755 index 0000000..5300183 --- /dev/null +++ b/SD-VBS/common/toolbox/toolbox_basic/affine/hemisphere_s.m | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | function [x,y,z] = hemisphere(r) | ||
| 2 | %HEMISPHERE Generate sphere and transform from spherical coordinates. | ||
| 3 | % | ||
| 4 | % [X,Y,Z] = HEMISPHERE(N) generates three (n+1)-by-(n+1) | ||
| 5 | % matrices so that SURF(X,Y,Z) produces a sphere. | ||
| 6 | % | ||
| 7 | % [X,Y,Z] = HEMISPHERE(R,N) generates three (n+1)-by-(n+1) | ||
| 8 | % matrices so that SURF(X,Y,Z,R) produces a sphere colored by R | ||
| 9 | % | ||
| 10 | % [X,Y,Z] = HEMISPHERE(R,THETA,PHI) converts from spherical coordinates | ||
| 11 | % to cartesian coordinates. | ||
| 12 | |||
| 13 | % Modified from | ||
| 14 | % Clay M. Thompson 4-24-91 | ||
| 15 | % Copyright (c) 1991-92 by the MathWorks, Inc. | ||
| 16 | % by Carlo Tomasi | ||
| 17 | |||
| 18 | error(nargchk(1,3,nargin)); | ||
| 19 | |||
| 20 | n = r; | ||
| 21 | % 0 <= theta <= 2*pi and 0 <= phi <= pi/2 | ||
| 22 | [theta,phi] = meshgrid((pi/n/2)*[-n:2:n],(pi/2/n)*[-n:2:n]); | ||
| 23 | r = ones(n+1,n+1); | ||
| 24 | |||
| 25 | x = r .* cos(phi) .* sin(theta); | ||
| 26 | y = r .* sin(phi); | ||
| 27 | z = r .* cos(phi) .* cos(theta).*phi.*theta; | ||
