ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 07.08.2024

Просмотров: 20

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

Звіт до лабораторної роботи № 6

Тема: Графіка.

Мета: Створення програми для виконання певних математичних дій та , яка складається з 5 модулів, кожен з яких містить окрему підзадачу.

Склад групи: Клюшниченко Д.В., Косенко І.М., Крикунов І.Є.

Керівник: Карпенко В.М.

Виконання роботи

Основна функція. Здійснює взаємодію між модулями.

Завдання 1. Програма будує січну у трикутній піраміді, що проходить через одну із сторін основи і середину протилежного ребра.

Завдання 3. Програма будує в шестикутній призмі січну, що проходить через одну зі сторін нижньої основи та протилежну ії сторону верхньої основи..

Задання 4. Програма створює 4 зображення згідно варіанту.

Контрольні питання. Програма створює 2 зображення згідно варіанту.

Приклад роботи з програмою

Лістинг модуля Main

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "MainUnit.h"

#include "CQUnit.h"

#include "Unit6_3.h"

#include "Unit4.h"

#include "Kubuk.h"

#include "Un2.h"

#include "Un3.h"

#include "Un4.h"

//---------------------------------------------------------------------------

void __fastcall TMainForm::Button1Click(TObject *Sender)

{

switch(RadioGroup1->ItemIndex)

{

case 0: Form1->Show();break;

case 1: Form6_3->Show();break;

case 2: Form4->Show();break;

case 3: CQForm->Show();break;

}

}

Лістинг модуля Unit6_3

#include <vcl.h>

#pragma hdrstop

#include "Unit6_3.h"

//---------------------------------------------------------------------------

void __fastcall TForm6_3::FormActivate(TObject *Sender)

{

Image1->Hide();

Image1->Canvas->Pen->Color = clGreen;

Image1->Canvas->MoveTo(20,50);Image1->Canvas->LineTo(100,20);

Image1->Canvas->LineTo(240,20);Image1->Canvas->LineTo(300,50);

Image1->Canvas->LineTo(300,270);Image1->Canvas->LineTo(220,320);

Image1->Canvas->LineTo(80,320);Image1->Canvas->LineTo(20,270);

Image1->Canvas->LineTo(20,50);Image1->Canvas->LineTo(80,80);

Image1->Canvas->LineTo(220,80);Image1->Canvas->LineTo(300,50);


Image1->Canvas->MoveTo(220,80);Image1->Canvas->LineTo(220,320);

Image1->Canvas->MoveTo(80,320);Image1->Canvas->LineTo(80,80);

Image1->Canvas->Pen->Style = psDot;

Image1->Canvas->MoveTo(100,20);Image1->Canvas->LineTo(100,250);

Image1->Canvas->LineTo(240,250);Image1->Canvas->LineTo(300,270);

Image1->Canvas->MoveTo(20,270);Image1->Canvas->LineTo(100,250);

Image1->Canvas->MoveTo(240,20);Image1->Canvas->LineTo(240,250);

Image1->Canvas->Pen->Color = clRed;

Image1->Canvas->MoveTo(20,270);Image1->Canvas->LineTo(240,20);

Image1->Canvas->LineTo(80,320);Image1->Canvas->LineTo(300,50);

}

//---------------------------------------------------------------------------

void __fastcall TForm6_3::Button1Click(TObject *Sender)

{

Image1->Show();

}

//---------------------------------------------------------------------------

void __fastcall TForm6_3::Button2Click(TObject *Sender)

{

Image1->Hide();

}


Лістинг модуля Unti4

#include <vcl.h>

#pragma hdrstop

#include "Kubuk.h"

//---------------------------------------------------------------------------

void __fastcall TF1::FormCreate(TObject *Sender)

{

Image1->Canvas->Rectangle(40,100,310,370);

Image1->Canvas->MoveTo(130,100);Image1->Canvas->LineTo(130,370);

Image1->Canvas->MoveTo(220,100);Image1->Canvas->LineTo(220,370);

Image1->Canvas->MoveTo(40,190);Image1->Canvas->LineTo(310,190);

Image1->Canvas->LineTo(370,130);Image1->Canvas->MoveTo(40,280);

Image1->Canvas->LineTo(310,280); Image1->Canvas->LineTo(370,220);

Image1->Canvas->MoveTo(40,100);Image1->Canvas->LineTo(100,40);

Image1->Canvas->LineTo(370,40);Image1->Canvas->LineTo(309,100);

Image1->Canvas->MoveTo(370,40);Image1->Canvas->LineTo(370,310);

Image1->Canvas->LineTo(309,370);Image1->Canvas->MoveTo(130,100);

Image1->Canvas->LineTo(190,40);Image1->Canvas->MoveTo(220,100);

Image1->Canvas->LineTo(280,40);Image1->Canvas->MoveTo(330,349);

Image1->Canvas->LineTo(330,79);Image1->Canvas->MoveTo(350,329);

Image1->Canvas->LineTo(350,59);Image1->Canvas->MoveTo(61,79);

Image1->Canvas->LineTo(330,79);Image1->Canvas->MoveTo(81,59);

Image1->Canvas->LineTo(351,59);

Image1->Canvas->Brush->Color=clYellow;

Image1->Canvas->FloodFill(50,130,clWhite,fsSurface);

Image1->Canvas->FloodFill(150,350,clWhite,fsSurface);

Image1->Canvas->FloodFill(369,128,clWhite,fsSurface);

Image1->Canvas->FloodFill(180,70,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clRed;

Image1->Canvas->FloodFill(175,235,clWhite,fsSurface);

Image1->Canvas->FloodFill(335,330,clWhite,fsSurface);

Image1->Canvas->FloodFill(250,95,clWhite,fsSurface);

Image1->Canvas->FloodFill(230,50,clWhite,fsSurface);

Image1->Canvas->FloodFill(315,235,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clMaroon;

Image1->Canvas->FloodFill(60,235,clWhite,fsSurface);

Image1->Canvas->FloodFill(270,350,clWhite,fsSurface);

Image1->Canvas->FloodFill(340,145,clWhite,fsSurface);

Image1->Canvas->FloodFill(320,45,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clBlue;

Image1->Canvas->FloodFill(50,95,clWhite,fsSurface);

Image1->Canvas->FloodFill(270,150,clWhite,fsSurface);

Image1->Canvas->FloodFill(360,280,clWhite,fsSurface);

Image1->Canvas->FloodFill(300,70,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clGreen;

Image1->Canvas->FloodFill(150,115,clWhite,fsSurface);

Image1->Canvas->FloodFill(270,230,clWhite,fsSurface);

Image1->Canvas->FloodFill(60,350,clWhite,fsSurface);

Image1->Canvas->FloodFill(340,235,clWhite,fsSurface);

Image1->Canvas->FloodFill(100,50,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clGray;

Image1->Canvas->FloodFill(30,100,clWhite,fsSurface);

}

//---------------------------------------------------------------------------

void __fastcall TF2::FormCreate(TObject *Sender)

{

Image1->Canvas->Ellipse(100,100,180,180);

Image1->Canvas->Arc(100,180,180,260,140,260,144,180);

Image1->Canvas->MoveTo(140,180);Image1->Canvas->LineTo(140,360);

Image1->Canvas->Arc(80,260,200,360,141,360,144,260);

Image1->Canvas->MoveTo(130,177);Image1->Canvas->LineTo(145,157);

Image1->Canvas->LineTo(176,157);Image1->Canvas->Ellipse(135,120,160,153);

Image1->Canvas->Arc(145,120,165,153,152,123,153,153);

Image1->Canvas->Ellipse(148,130,158,145);

Image1->Canvas->Pen->Color=clMaroon;

Image1->Canvas->Pen->Width=3;

Image1->Canvas->MoveTo(193,330);

Image1->Canvas->LineTo(210,345);Image1->Canvas->LineTo(160,375);


Image1->Canvas->LineTo(180,375);Image1->Canvas->MoveTo(199,310);

Image1->Canvas->LineTo(230,335);Image1->Canvas->LineTo(207,368);

Image1->Canvas->LineTo(225,368);Image1->Canvas->MoveTo(178,227);

Image1->Canvas->LineTo(240,245);Image1->Canvas->LineTo(260,217);

Image1->Canvas->Arc(259,211,280,227,280,217,260,219);

Image1->Canvas->MoveTo(178,207);

Image1->Canvas->LineTo(255,193);Image1->Canvas->LineTo(248,160);

Image1->Canvas->Arc(248,150,268,170,260,150,248,165);

Image1->Canvas->MoveTo(140,233);

Image1->Canvas->LineTo(80,265);Image1->Canvas->LineTo(67,290);

Image1->Canvas->LineTo(57,280);Image1->Canvas->MoveTo(140,213);

Image1->Canvas->LineTo(60,207);Image1->Canvas->LineTo(80,170);

Image1->Canvas->Arc(60,160,81,180,81,172,65,165);

Image1->Canvas->Arc(165,157,188,113,175,157,190,140);

Image1->Canvas->MoveTo(187,140);Image1->Canvas->LineTo(185,120);

Image1->Canvas->Arc(185,140,215,100,205,105,185,122);

Image1->Canvas->Arc(163,128,175,157,163,133,169,157);

Image1->Canvas->MoveTo(164,133);Image1->Canvas->LineTo(170,120);

Image1->Canvas->Arc(163,128,175,157,163,133,169,157);

Image1->Canvas->Arc(160,100,176,122,170,120,175,107);

Image1->Canvas->Arc(150,95,175,118,173,109,155,100);

Image1->Canvas->Brush->Color=clBlack;

Image1->Canvas->FloodFill(145,358,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clMaroon;

Image1->Canvas->FloodFill(145,190,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clBlack;

Image1->Canvas->FloodFill(149,170,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clGray;

Image1->Canvas->FloodFill(135,140,clWhite,fsSurface);

Image1->Canvas->FloodFill(170,155,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clMaroon;

Image1->Canvas->FloodFill(139,131,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clBlue;

Image1->Canvas->FloodFill(150,133,clWhite,fsSurface);

}

void __fastcall TF3::FormCreate(TObject *Sender)

{

Image1->Canvas->MoveTo(100,400);Image1->Canvas->LineTo(150,275);

Image1->Canvas->LineTo(200,400);Image1->Canvas->LineTo(100,400);

Image1->Canvas->MoveTo(200,400);Image1->Canvas->LineTo(325,350);

Image1->Canvas->LineTo(275,225);Image1->Canvas->LineTo(150,275);

Image1->Canvas->MoveTo(100,400);Image1->Canvas->LineTo(75,415);

Image1->Canvas->MoveTo(150,275);Image1->Canvas->LineTo(150,400);

Image1->Canvas->MoveTo(200,400);Image1->Canvas->LineTo(225,415);

Image1->Canvas->MoveTo(325,350);Image1->Canvas->LineTo(350,352);

Image1->Canvas->Pen->Width=3;

Image1->Canvas->MoveTo(79,406);Image1->Canvas->LineTo(79,417);

Image1->Canvas->MoveTo(221,406);Image1->Canvas->LineTo(221,417);

Image1->Canvas->MoveTo(346,346);Image1->Canvas->LineTo(346,356);

Image1->Canvas->Pen->Width=0;

Image1->Canvas->Brush->Color=clBlue;

Image1->Canvas->FloodFill(300,300,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clNavy;

Image1->Canvas->FloodFill(102,398,clWhite,fsSurface);

Image1->Canvas->FloodFill(198,398,clWhite,fsSurface);

Image1->Canvas->MoveTo(77,375);Image1->Canvas->LineTo(88,375);

Image1->Canvas->LineTo(87,338);Image1->Canvas->MoveTo(77,375);

Image1->Canvas->LineTo(78,338);Image1->Canvas->Brush->Color=clGreen;

Image1->Canvas->Ellipse(67,265,98,341);

Image1->Canvas->Brush->Color=clMaroon;

Image1->Canvas->FloodFill(80,350,clWhite,fsSurface);

Image1->Canvas->MoveTo(328,325);Image1->Canvas->LineTo(338,325);

Image1->Canvas->LineTo(337,288);Image1->Canvas->MoveTo(328,325);

Image1->Canvas->LineTo(329,288);Image1->Canvas->Brush->Color=clGreen;

Image1->Canvas->Ellipse(300,225,368,295);


Image1->Canvas->Brush->Color=clMaroon;

Image1->Canvas->FloodFill(330,310,clWhite,fsSurface);

Image1->Canvas->MoveTo(0,200);Image1->Canvas->LineTo(700,200);

Image1->Canvas->Brush->Color=clLime;

Image1->Canvas->FloodFill(1,250,clWhite,fsSurface);

Image1->Canvas->MoveTo(0,0);Image1->Canvas->LineTo(700,0);

Image1->Canvas->Brush->Color=clBlue;

Image1->Canvas->FloodFill(100,100,clWhite,fsSurface);

}

void __fastcall TF4::FormCreate(TObject *Sender)

{

int x=50; int x1=250; int y=300; int y1=470;

Image1->Canvas->Rectangle(x,y,x1,y1);

Image1->Canvas->MoveTo(249,470); Image1->Canvas->LineTo(314,413);

Image1->Canvas->LineTo(314,243); Image1->Canvas->MoveTo(50,300);

Image1->Canvas->LineTo(114,243); Image1->Canvas->LineTo(314,243);

Image1->Canvas->LineTo(249,300); Image1->Canvas->Rectangle(315,243,114,130);

Image1->Canvas->MoveTo(50,335); Image1->Canvas->LineTo(250,335);

Image1->Canvas->Ellipse(65,320,110,327); Image1->Canvas->Ellipse(130,310,150,330);

Image1->Canvas->Ellipse(157,310,177,330); Image1->Canvas->Ellipse(184,310,204,330);

Image1->Canvas->Rectangle(73,365,227,440);

Image1->Canvas->Ellipse(195,255,265,290);Image1->Canvas->Ellipse(105,255,175,290);

Image1->Canvas->Brush->Color=clBlack;

Image1->Canvas->FloodFill(120,280,clWhite,fsSurface);Image1->Canvas->FloodFill(200,280,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clGray; Image1->Canvas->FloodFill(140,320,clWhite,fsSurface);

Image1->Canvas->FloodFill(160,320,clWhite,fsSurface);Image1->Canvas->FloodFill(190,320,clWhite,fsSurface);

Image1->Canvas->Brush->Color=clBlack;

Image1->Canvas->FloodFill(70,322,clWhite,fsSurface); Image1->Canvas->FloodFill(80,370,clWhite,fsSurface);

}