MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: in center of a triangle

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52643] Re: [mg19589] in center of a triangle
  • From: habdelmoez at yahoo.com (Hesham AM)
  • Date: Sun, 5 Dec 2004 02:08:42 -0500 (EST)
  • References: <7qvtfb$4lg@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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.
>>
>>Thanks for any help you could offer on this!!
>>
>>Tom De Vries
>>Edmonton, Alberta, Canada
>>
>
>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}][[1]];
>    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[4], Point /@ {ptA, ptB, ptC},
>        Blue, Line[{ptA, ptB, ptC, ptA}],
>        OrangeRed, Circle[incenter, inradius],
>        Black, Point[incenter]}],
>
>AspectRatio -> Automatic, PlotRange -> All, Background -> Linen,
>{Frame -> True, FrameLabel -> {x, y}}];
>
>David Park
>djmp at earthlink.net
><a
href="http://home.earthlink.net/~djmp/";>http://home.earthlink.net/~djmp/</a>


  • Prev by Date: Re: Complex Analysis using Mathematica
  • Next by Date: Re: Complex Analysis using Mathematica
  • Previous by thread: Re: Re: Re: A problem of numerical precision
  • Next by thread: Re: Re: in center of a triangle