       Re: Re: in center of a triangle

• To: mathgroup at smc.vnet.net
• Subject: [mg52652] Re: [mg52643] Re: [mg19589] in center of a triangle
• From: DrBob <drbob at bigfoot.com>
• Date: Tue, 7 Dec 2004 04:09:38 -0500 (EST)
• References: <7qvtfb\$4lg@smc.vnet.net> <200412050708.CAA26793@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```>> I'll be appreciated much if you just reply with ... or how can I calculate it.

That's exactly what David did.

Bobby

On Sun, 5 Dec 2004 02:08:42 -0500 (EST), Hesham AM <habdelmoez at yahoo.com> wrote:

> Hi there:
>
> I'll be appreciated much if you just reply with the rectangular
> coordinates of the incenter or how can I calculate it. I will use Vb.
>
> Many thanks !
>
> Hesham AM
>
>
>
> On 6 Sep 1999 04:19:55 -0400, David Park wrote:
>>> Hello!
>>>
>>> I was wondering if anyone has seen or has written a Mathematica
> procedure to
>>> generate the incenter of a triangle given the vertices of the
> triangle.  The
>>> incenter of a triangle is the point at which the angle bisectors
> meet.  From
>>> this point you can draw an inscribed circle in the triangle.
>>>
>>>
>>> Tom De Vries
>>>
>>
>> Hi Tom,
>>
>> Here is a routine which will calculate the incenter and inradius for
> an inscribed
>> circle in a general triangle.
>>
>> InscribedCircle[ptA:{_, _}, ptB:{_, _}, ptC:{_, _}] :=
>>  Module[{AB, BC, AC, a, b, c, s, ptP, ptQ, AP, BQ, p, q, psol, qsol,
> pqsol,
>>    center, radius}, AB = ptB - ptA; BC = ptC - ptB; AC = ptC - ptA;
>>    a = Sqrt[BC . BC]; b = Sqrt[AC . AC]; c = Sqrt[AB . AB];
>>    AP = ptB + p*BC - ptA; BQ = ptA + q*AC - ptB;
>>    psol = Solve[AP . AB/c == AP . AC/b, p][[1,1]];
>>    qsol = Solve[BQ . BC/a == BQ . (-AB)/c, q][[1,1]];
>>    ptP = ptB + p*BC /. psol; ptQ = ptA + q*AC /. qsol;
>>    pqsol = Solve[ptA + p*(ptP - ptA) == ptB + q*(ptQ - ptB), {p,
> q}][];
>>    center = ptA + p*(ptP - ptA) /. pqsol; s = (a + b + c)/2;
>>    radius = Sqrt[((s - a)*(s - b)*(s - c))/s]; {center, radius}]
>>
>> This tests it on randomly generated triangles.
>> << Graphics`Colors`
>> ran := Random[Real, {0, 5}];
>>
>> ptA = {ran, ran};
>> ptB = {ran, ran};
>> ptC = {ran, ran};
>> {incenter, inradius} = InscribedCircle[ptA, ptB, ptC];
>> Show[Graphics[
>>  {AbsolutePointSize, Point /@ {ptA, ptB, ptC},
>>        Blue, Line[{ptA, ptB, ptC, ptA}],
>>        Black, Point[incenter]}],
>>
>> AspectRatio -> Automatic, PlotRange -> All, Background -> Linen,
>> {Frame -> True, FrameLabel -> {x, y}}];
>>
>> David Park
>> <a
>
>
>
>

--
DrBob at bigfoot.com
www.eclecticdreams.net

```

• Prev by Date: Re: Re: Re: Finding the Fourier transform of discrete functions
• Next by Date: Re: contour for polar coordinate
• Previous by thread: Re: in center of a triangle
• Next by thread: Partial fraction command