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$>
References: <>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1274281744 25553 (19 May 2010 15:09:04 GMT)
NNTP-Posting-Date: Wed, 19 May 2010 15:09:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:637256

ZEESHAN MOHIUDDIN <> wrote in message <>...
> 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