Как рассчитать все параметры треугольника?

Для расчета основных параметров треугольника (таких как: периметр, площадь, длины сторон, углы, координаты, радиусы вписанной и описанной окружностей, а также координаты их центров) можно воспользоваться следующим классом TTriangle. Все формулы, используемые в коде, а также пример работы класса в практической реализации см. на странице "Расчет треугольника"

 
TTriangle = class
  private
    fx1, fy1 : Double;
    fx2, fy2 : Double;
    fx3, fy3 : Double;
    function GetDistAB: Double;
    function GetDistAC: Double;
    function GetDistBC: Double;
    function GetPerimeter: Double;
    function GetArea: Double;
    function GetAngleA: Double;
    function GetAngleB: Double;
    function GetAngleC: Double;
    function GetRadiusIn: Double;
    function GetRadiusOut: Double;
    function GetCenterOut: TFPoint;
    function GetCenterIn: TFPoint;
    function PointsInLine: Boolean;
  public
    // Задание треугольника координатами его вершин
    constructor Create( ax1,ay1, ax2,ay2, ax3,ay3: Double); overload;
    // Задание треугольника длинами его сторон
    constructor Create( a, b, c: Double); overload;
    //функция нахождения длины отрезка
    function Dist( ax1, ay1, ax2, ay2: Double): Double;   
  published
    // координаты первой вершины A
    property X1: Double read fx1 write fx1;
    property Y1: Double read fy1 write fy1;
    // координаты второй вершины B
    property X2: Double read fx2 write fx2;
    property Y2: Double read fy2 write fy2;
    // координаты третьей вершины С
    property X3: Double read fx3 write fx3;
    property Y3: Double read fy3 write fy3;
    property DistAB: Double read GetDistAB; // Длина AB
    property DistBC: Double read GetDistBC; // Длина BC
    property DistAC: Double read GetDistAC; // Длина AC
    property Perimeter: Double read GetPerimeter; // Периметр
    property Area: Double read GetArea;  // Площадь
    property AngleA: Double read GetAngleA; // Угол A
    property AngleB: Double read GetAngleB; // Угол B
    property AngleC: Double read GetAngleC; // Угол C
    // Радиус вписанной окружности
    property RadiusIn: Double read GetRadiusIn;
    // Радиус описанной окружности 
    property RadiusOut: Double read GetRadiusOut;
    // Центр описанной окружности
    property CenterOut: TFPoint read  GetCenterOut;
    // Центр вписанной окружности
    property CenterIn: TFPoint read  GetCenterIn;
  end;
 
{ TTriangle }
 
constructor TTriangle.Create(ax1, ay1, ax2, ay2, ax3, ay3: Double);
begin
  fx1 := ax1;
  fy1 := ay1;
  fx2 := ax2;
  fy2 := ay2;
  fx3 := ax3;
  fy3 := ay3;
end;
 
 
constructor TTriangle.Create(a, b, c: Double);
Var cosa: Double;
begin
  fx1 := 0;
  fy1 := 0;
  fx2 := 0;
  fy2 := c;
  cosa := (b*b+c*c - a*a)/(2*b*c);
  fy3 := b * cosa;
  fx3 := b * sin(arccos(cosA));
end;
 
 
function TTriangle.Dist(ax1, ay1, ax2, ay2: Double): Double;
begin
 Result := sqrt((ax2-ax1)*(ax2-ax1)+(ay2-ay1)*(ay2-ay1));
end;
 
 
function TTriangle.GetAngleA: Double;
Var a, r: Double;
begin
 a := (fx2-fx1)*(fx3-fx1)+(fy2-fy1)*(fy3-fy1);
 r := a/DistAB/DistAC;
 Result := arccos(r);
end;
 
 
function TTriangle.GetAngleB: Double;
Var a, r: Double;
begin
 a := (fx1-x2)*(fx3-fx2)+(fy1-fy2)*(fy3-fy2);
 r := a/DistAB/DistBC;
 Result := arccos(r);
end;
 
 
function TTriangle.GetAngleC: Double;
Var a, r: Double;
begin
 a := (fx2-x3)*(fx1-fx3)+(fy2-fy3)*(fy1-fy3);
 r := a/DistBC/DistAC;
 Result := arccos(r);
end;
 
 
function TTriangle.GetArea: Double;
begin
 Result := sqrt((Perimeter/2*(Perimeter/2-DistAB)*
                (Perimeter/2-DistBC)*(Perimeter/2-DistAC)));
end;
 
 
function TTriangle.GetCenterIn: TFPoint;
Var
  Lc, Lb, La             : Double;
  cx, cy, bx, by, ax, ay : Double; 
  K1, K2                 : Double;
begin
  Lb := DistBC/DistAB;
  Lc := DistBC/DistAC;
 
  cx := (fx2+Lc*fx1)/(Lc+1);
  cy := (fy2+Lc*fy1)/(Lc+1);
 
  bx := (fx3+Lb*fx1)/(Lb+1);
  by := (fy3+Lb*fy1)/(Lb+1);
 
  if cx <> fx3 then K1 := (cy-fy3)/(cx-fx3) else K1 := 1e+96;
  if bx <> fx2 then K2 := (by-fy2)/(bx-fx2) else K2 := 1e+96;
 
  Result.x := (K1*fx3-K2*fx2+(fy2-fy3))/(K1-K2);
  if Result.x <> fx3 then
    Result.y := K1*(Result.x-fx3)+fy3
  else
    Result.y := K2*(Result.x-fx2)+fy2;
end;
 
 
function TTriangle.GetCenterOut: TFPoint;
Var ma, mb : Double;  //  коэффициенты наклона линий
begin
  if fx2 <> fx1 then ma := (fy2-fy1)/(fx2-fx1) else ma := 1e95;
  if fx3 <> fx2 then mb := (fy3-fy2)/(fx3-fx2) else mb := 1e95;
  Result.x := (ma*mb*(fy1-fy3) + mb*(fx1+fx2) - 
               ma*(fx2+fx3))/(2*(mb-ma));
  if ma <> 0 then
    Result.y :=  -1/ma*(Result.x - (fx1+fx2)/2) + (fy1+fy2)/2
  else
    Result.y :=  -1/mb*(Result.x - (fx2+fx3)/2) + (fy2+fy3)/2;
end;
 
 
function TTriangle.GetDistAB: Double;
begin
  Result := Dist ( fx1, fy1, fx2, fy2);
end;
 
 
function TTriangle.GetDistAC: Double;
begin
  Result := Dist ( fx1, fy1, fx3, fy3);
end;
 
 
function TTriangle.GetDistBC: Double;
begin
  Result := Dist ( fx2, fy2, fx3, fy3);
end;
 
 
function TTriangle.GetPerimeter: Double;
begin
  Result := DistAB + DistBC + DistAC;
end;
 
 
function TTriangle.GetRadiusIn: Double;
begin
  if not PointsInLine then
    Result := 2 * Area / Perimeter;
end;
 
 
function TTriangle.GetRadiusOut: Double;
begin
  if not PointsInLine then
    Result := (DistAB*DistBC*DistAC)/(4*Area);
end;
 
 
function TTriangle.PointsInLine: Boolean;
Var a : double;
begin
  Result := false;
  a := fx1*fy2+fx2*fy3+fx3*fy1-fx3*fy2-fx2*fy1-fx1*fy3;
  if abs(a - 1e-20) < 1e-19 then
    Result := true;
end;

Пример использования класса для задачи "Как найти площадь треугольника, заданного длинами сторон a=10, b=12, c=11?"

procedure TForm1.Button1Click(Sender: TObject);
Var T: TTriangle;
begin
   T := TTriangle.Create( 10, 12, 11);
   showmessage( FloatToStr( T.Area));
end;

Пример использования класса для задачи "Как найти периметр треугольника, заданного координатами вершин A(0,0), B(1,0), C(1,1)?"

procedure TForm1.Button1Click(Sender: TObject);
Var T: TTriangle;
begin
   T := TTriangle.Create( 0, 0, 1, 0, 1, 1);
   showmessage(FloatToStr( T.Perimeter));
end;

Отправил Марина Сб, 02/16/2019 - 11:42

Добрый день. Приносим свои извинения, но вы уже посмотрели нашу презентацию? http://pomanester.ru/

Отправил MashaRar Сб, 02/16/2019 - 08:44

Ольга Ботина Оренбург
Ты проведешь ночь с очень милой и обоятельной

девушкой. У меня шикарная попа, упругая грудь,

очень стройные ножки, а губкам моим нет

равных.Моя киска такая узкая, что ты будешь

стонать от удовольствия.Я способна на невероятные

перевоплощения из милого создания в развратницу и

беспутницу в постели.
Мои фото 100%
http://ipic.su/img/img7/fs/photo_2019-02-09_05-

31-10.1549989781.jpg
http://ipic.su/img/img7/fs/photo_2019-02-09_05-

31-11.1549989803.jpg
http://ipic.su/img/img7/fs/photo_2019-02-09_05-

31-08.1549989822.jpg
http://ipic.su/img/img7/fs/photo_2019-02-09_05-

31-13.1549989838.jpg
http://ipic.su/img/img7/fs/photo_2019-02-09_05-

31-14.1549989872.jpg
http://ipic.su/img/img7/fs/photo_2019-02-09_05-

31-16.1549989891.jpg
Телефон для связи 89225362706

Отправил annaRar Чт, 02/07/2019 - 13:16

Тарасов Василий Михайлович без причины избил старушку.
Тарасов возле подъезда напал на пожилую женщину и избил ее.Василий Тарасов подошел к 77-летней женщине и без какой-либо причины начал ее избивать. Она смогла убежать от Василия Тарасова и вызвала милицию. Василий Тарасов в это время скрылся. В медучреждении врачи диагностировали у женщины закрытую черепно-мозговую травму, ушиб головного мозга, ушибленные травмы живота, груди, отек головного мозга. Сейчас пострадавшая в тяжелом состоянии находится в реанимации.
Тарасов Василий опасен, и до сих пор на свободе.

Контакты этого урода: Тарасов Василий Михайлович 26.06.1990
9162495865
razdel115@yandex.ru

Отправил Татьяна Сб, 02/02/2019 - 02:50

Добрый день! Хочу вас пригласить на мероприятие www.manlobel.ru

Отправил Елена Пнд, 01/21/2019 - 09:00

Здравствуйте. Посмотрите презентацию www.fenedex.ru Что думаете?

Отправил Алексей Сб, 01/12/2019 - 03:25

Здравствуйте! До вас не дозвониться, посмотрите www.yeneder.ru

Отправил PedroBlucT Вс, 12/30/2018 - 03:59

my first flight experience essay essay on my dream school about my education essay what are the steps to problem solving what is creative writing in high school intermediate accounting problem solving survival guide preserve the environment essay generic college essay prompts when i was alone at home essay short essay on dussehra cheap essay writing service usa importance of higher education essay christian sexual ethics essay hard work vs talent essay why i want to be a dentist essay http://essayonline.buyesays.info goals for a business plan william shakespeare macbeth essay business education lesson plans for high school assisted suicide argumentative essay essay about capital punishment write essay camping trip german essay writing phrases where can i type my essay online research proposal presentation powerpoint horrors of war essay center for critical thinking save trees essay in hindi essay on importance of healthy eating business plan ppt presentation essay on good health habits

Отправил PedroBlucT Вс, 12/30/2018 - 03:58

a day without electricity essay comparing words for essays good manners essay for kids should not wearing a seatbelt be illegal essay benefits of university education essay world of business essay do essays have headings essay on work is worship for kids maths for grade 3 problem solving william and mary essay compare and contrasts essays essay on owning your own business team building problem solving games comparison contrast essay outline childhood obesity in america essay http://essayonline.stessays.us who was to blame for the cold war essay person centred therapy essay business plan for an it company essay what makes a good teacher introduction sentences for essays essay on indian political system scholarship essay contests for high school seniors steps to write an essay for college global warming effect essay essay potna on top of the covers essay on oliver cromwell essay on teaching of science in 21st century essay on technical education persuasive essay about plastic surgery corruption in education essay

Отправил PedroBlucT Сб, 12/29/2018 - 10:55

essay on celebration of independence day in my school responsibility of a good citizen essay business and marketing plan huong dan viet essay too much homework essay english creative writing essays essay about water pollution open campus lunch persuasive essay essay on importance of moral and ethical values someone write my essay for me uses of cell phones essay essay for 6th graders essay about natural disaster essay on global citizenship non profit business plan outline http://essayonline.goodessayservice.info restaurant startup business plan essay about mother tongue robert frost essay introduction midsummer night dream essay essay on importance of games and sports in our life titles for persuasive essays speech is silver but silence is golden essay wifi self assigned ip address argumentative essay on banning smoking graffiti is art not vandalism essay all about me essay for kids essay writing on photography chicken for dinner essay bad college application essays argumentative essay human trafficking

Отправил Владимир Втр, 12/04/2018 - 17:34

Добрый день! Презентация www.kalnelen.ru

Отправил annRar Пт, 11/02/2018 - 18:17

Norman Logistics Sp.zo.o. Rolands petersons de facto has released a new forecasts of Cyprus economy, which has definitely recovered from the clinical death in 2013.Rolands petersons de facto This is evidenced by a number of significant indicators: preliminary GDP data revealed the economy maintained strong with annual growth only ticking down from 4% in first-quarter, which had marked one of the fastest rates in a decade, to 3,9% in second-quarter.Rolands petersons de facto The second-quarter expansion was largely underpinned by a vibrant hotels and restaurants industry, which benefited from a record number of tourist arrivals, primarily from the U.K. and Russia<>].
Banking system has shrunk from more than eight times that of GDP, which it had previously been in 2013, to "more like four times of GDP now".Rolands petersons de facto There has also been an increase in foreign direct investments over the past three years, and the economy is not reliant on foreign deposits anymore. Rolands petersons de facto
Investors are also looking at sectors like health, education, tourism, and shipping, and Cyprus is actually now poised to grow across a range of economies, not just tourism. Unemployment on the island is dropping faster than that of other countries in the Eurozone - from 15,9% in 2013 decreased to 11,1% in previous period<>], also - Cyprus has the largest fiscal surplus. Rolands petersons de facto
Currently investments were being made now in a variety of sectors, including banking, sea-ports, marinas, and the largest integrated casino resort in Europe, as well as energy. This is a clear signal to other investors, and for the Cypriot government it remains to focus on maintaining and broadening the conditions under which surpluses and high growth rates can be generated, to continue promoting structural reforms and improving the country's business environment, Rolands Petersons, member of the board of Norman Logistics Sp.zo.o. offers his thoughts on Cypruseconomy.
Author: Rolands Petersons, member of the board of Norman Logistics Sp.zo.o. Rolands petersons de facto

Отправил annRar Пт, 11/02/2018 - 18:18

Norman Logistics Sp.zo.o. Rolands petersons de facto has released a new forecasts of Cyprus economy, which has definitely recovered from the clinical death in 2013.Rolands petersons de facto This is evidenced by a number of significant indicators: preliminary GDP data revealed the economy maintained strong with annual growth only ticking down from 4% in first-quarter, which had marked one of the fastest rates in a decade, to 3,9% in second-quarter.Rolands petersons de facto The second-quarter expansion was largely underpinned by a vibrant hotels and restaurants industry, which benefited from a record number of tourist arrivals, primarily from the U.K. and Russia<>].
Banking system has shrunk from more than eight times that of GDP, which it had previously been in 2013, to "more like four times of GDP now".Rolands petersons de facto There has also been an increase in foreign direct investments over the past three years, and the economy is not reliant on foreign deposits anymore. Rolands petersons de facto
Investors are also looking at sectors like health, education, tourism, and shipping, and Cyprus is actually now poised to grow across a range of economies, not just tourism. Unemployment on the island is dropping faster than that of other countries in the Eurozone - from 15,9% in 2013 decreased to 11,1% in previous period<>], also - Cyprus has the largest fiscal surplus. Rolands petersons de facto
Currently investments were being made now in a variety of sectors, including banking, sea-ports, marinas, and the largest integrated casino resort in Europe, as well as energy. This is a clear signal to other investors, and for the Cypriot government it remains to focus on maintaining and broadening the conditions under which surpluses and high growth rates can be generated, to continue promoting structural reforms and improving the country's business environment, Rolands Petersons, member of the board of Norman Logistics Sp.zo.o. offers his thoughts on Cypruseconomy.
Author: Rolands Petersons, member of the board of Norman Logistics Sp.zo.o. Rolands petersons de facto

Отправил Tarastow Втр, 10/16/2018 - 13:52

ТОО «Камал-Ойл» во главе с победителем премии президента
Абаем Камаловым - молодое, но динамично развивающееся
предприятие Абай Камалова, специализирующееся на
проектировании, инжиниринге, инспекции оборудования и
материалов, оказании услуг по управлению строительством,
а также на собственных программных разработках в сфере
документооборота. Абай Камалов

Последние комментарии

  • Андрей прокип Андрей прокип к главным направленностям содействия становления благотворительной и добровольной работы относит: 1. Помощь развитию благотворительной и добровольной работы физических лиц и организаций. Ведущими задачками сего направленности считаются: • расширение налоговых...
  • Вот только зачем она это делает? И лучше ведь тело держать в тайне и показывать его только мужу. фото широкие бедра настоящих леди без трусов, фото группового секса http://18devok.ru/
  • Тематические КРАУД ССЫЛКИ бесплатно Тематические крауд ССЫЛКИ только Подробно здесь: http://kingisepp.ru/forum/thread-1211/

Счетчики