Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Inscribed triangle in delaunay trianglation mesh Date: Wed, 19 May 2010 15:09:04 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 28 Message-ID: <ht0uug$ouh$1@fred.mathworks.com> References: <2030930001.184872.1274255660644.JavaMail.root@gallium.mathforum.org> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-03-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1274281744 25553 172.30.248.38 (19 May 2010 15:09:04 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Wed, 19 May 2010 15:09:04 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:637256 ZEESHAN MOHIUDDIN <zeeextra@yahoo.com> wrote in message <2030930001.184872.1274255660644.JavaMail.root@gallium.mathforum.org>... > Dear All > > I need your help in MATLAB for constructing a shape. > > First I need to draw the set of triangular mesh . Inside the each triangle of the mesh, I need to draw an inscribed triangle. The boundary of the inscribed triangle is placed at certain distance with that of the triangluar mesh triangle. > > I used the following program to create the triangular mesh : > > x=rand(1,12); > y=rand(1,12); > tri=delaunay(x,y); > trimesh(tri,x,y) > > Now I would like to generate an inscribed triangle in this mesh in such a way that the distance between the inscribed and mesh triangle lies between 0-1 ( using normal or lognormal distribution). Can you please provide some help in this matter. > > BR If the vertices of a triangle are three-element vectors P1, P2, P3, then with t a number between 0 and 1 do this: P0 = (P1+P2+P3)/3; Q1 = t*P1+(1-t)*P0; Q2 = t*P2+(1-t)*P0; Q3 = t*P3+(1-t)*P0; These give the vertices of a triangle within the above triangle and sides parallel to its sides. Choose t according the desired relative spacing. With t = 1, the triangles coincide. With t = 0 the second triangle shrinks to a point. You want it spaced somewhere in between randomly, so let t be a random number according to whatever distribution you wish. Roger Stafford