Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!h30g2000vbr.googlegroups.com!not-for-mail
From: ImageAnalyst <imageanalyst@mailinator.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: create grayscale star sign
Date: Tue, 11 Aug 2009 18:58:25 -0700 (PDT)
Organization: http://groups.google.com
Lines: 61
Message-ID: <1a0ea8ac-965b-4e5a-880b-cba91d4d1e67@h30g2000vbr.googlegroups.com>
References: <h2n7vl$5th$1@fred.mathworks.com> <0b84ba91-b15b-4dc1-9615-e9dff36570d8@s31g2000yqs.googlegroups.com> 
	<9448389f-33c2-4239-808f-785b7f809d93@c2g2000yqi.googlegroups.com> 
	<h5s5o1$r5f$1@fred.mathworks.com>
NNTP-Posting-Host: 75.186.70.56
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1250042305 17473 127.0.0.1 (12 Aug 2009 01:58:25 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 12 Aug 2009 01:58:25 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: h30g2000vbr.googlegroups.com; posting-host=75.186.70.56; 
	posting-account=0rLUzAkAAABojYSRC64DkTbtiSCX77HH
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 
	GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 
	3.5.21022; AskTB5.5),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:562559


On Aug 11, 12:20 pm, "M. David " <M.Da...@gmail.com> wrote:
> Thanks a lot ImageAnalyst,
>
> I am trying to change theta values of the following codes to obtain more oval corners instead of the sharp corners. Could you please examine the following codes:
>
> t = (-1/4:1/28:3/4)*2*pi;
> r1 = 44; r2 = 19;
> r = (r1+r2)/2 + (r1-r2)/2*(-1).^[0:28];
> x2 = r.*cos(t);
> y2 = r.*sin(t);
> plot(x2,y2,'b')
>
> what should be the t values?
> best regards- Hide quoted text -
---------------------------------------------------------------------------------------------------------------
M.:
Try this instead (copy and paste but fix any line breaks introduced by
the newsreader):
Regards,
ImageAnalyst

% Demo macro to draw a rounded star (like a splat).
% by ImageAnalyst
clc;
close all;
clear all;
workspace;

% Select the inner and outer radius.
outerRadius = 44  % You can change this
innerRadius = 19  % You can change this
% Select the number of lobes around the circle.
numberOfLobes = 8;  % You can change this

period = 2 * pi / numberOfLobes;
meanRadius = (outerRadius + innerRadius)/2
amplitude = (outerRadius - innerRadius)/2
t = (0:.005:1)*2*pi; % Independent parameter
variableRadius = amplitude * cos(2*pi*t/period) + meanRadius
subplot(2,2,1);
plot(variableRadius);
ylim([0 outerRadius]);
title('VariableRadius');
period = 2*pi;  % Need to change this now.
x2 = variableRadius .* cos(2*pi*t/period);
y2 = variableRadius .* sin(2*pi*t/period);
subplot(2,2,2);
plot(t, x2);
title('x2 vs. t');
subplot(2,2,3);
plot(t, y2);
title('y2 vs. t');
subplot(2,2,4);
plot(x2,y2,'b')
title('x2 vs y2');

% Maximize window.
set(gcf, 'Position', get(0, 'ScreenSize')); % Maximize figure.