Сечение многогранников

Курсовой проект - Математика и статистика

Другие курсовые по предмету Математика и статистика

Скачать Бесплатно!
Для того чтобы скачать эту работу.
1. Пожалуйста введите слова с картинки:

2. И нажмите на эту кнопку.
закрыть



seButton;

Shift: TShiftState; X, Y: Integer);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form2: TForm2;

implementation

uses Unit1,Unit3;

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);

begin

Shape1.Brush.Color:=ColorIntersection;

Shape2.Brush.Color:=ColorEder;

Shape3.Brush.Color:=ColorRebro;

Shape4.Brush.Color:=ColorNet;

Shape5.Brush.Color:=ActivColor;

Shape6.Brush.Color:=ColorPointIntersection;

Shape7.Brush.Color:=ColorUnEder;

end;

procedure TForm2.Shape1MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

if Form2.CD1.Execute then

begin

ColorIntersection:=Form2.CD1.Color;

Form2.Shape1.Brush.Color:=Form2.CD1.Color

end

end;

procedure TForm2.Shape2MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

if Form2.CD1.Execute then

begin

ColorEder:=Form2.CD1.Color;

Form2.Shape2.Brush.Color:=Form2.CD1.Color

end

end;

procedure TForm2.Shape3MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

var i,j:word;

begin

if Form2.CD1.Execute then

begin

ColorRebro:=Form2.CD1.Color;

Form2.Shape3.Brush.Color:=Form2.CD1.Color;

for i:=1 to 3 do

for j:=1 to M do

Scene[i].G[j].ColorRb:=ColorRebro;

end

end;

procedure TForm2.Shape4MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

if Form2.CD1.Execute then

begin

ColorNet:=Form2.CD1.Color;

Form2.Shape4.Brush.Color:=Form2.CD1.Color

end

end;

procedure TForm2.Shape5MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

if Form2.CD1.Execute then

begin

ActivColor:=Form2.CD1.Color;

Form2.Shape5.Brush.Color:=Form2.CD1.Color

end

end;

procedure TForm2.Shape6MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

if Form2.CD1.Execute then

begin

ColorPointIntersection:=Form2.CD1.Color;

Form2.Shape6.Brush.Color:=Form2.CD1.Color

end

end;

procedure TForm2.BitBtn1Click(Sender: TObject);

begin

Form2.Close

end;

procedure TForm2.CD1Close(Sender: TObject);

begin

Form1.Repaint;

end;

procedure TForm2.Shape7MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

if Form2.CD1.Execute then

begin

ColorUnEder:=Form2.CD1.Color;

Form2.Shape7.Brush.Color:=Form2.CD1.Color

end

end;

end.

unit Unit3;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Buttons, ExtCtrls,Math;

type

TForm3 = class(TForm)

GroupBox1: TGroupBox;

ListBox1: TListBox;

Label1: TLabel;

Edit1: TEdit;

Label2: TLabel;

Edit2: TEdit;

Label3: TLabel;

Splitter1: TSplitter;

BitBtn1: TBitBtn;

procedure FormCreate(Sender: TObject);

procedure Edit2KeyPress(Sender: TObject; var Key: Char);

procedure Edit1KeyPress(Sender: TObject; var Key: Char);

procedure FormPaint(Sender: TObject);

procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

procedure PaintIntersection;

public

{ Public declarations }

end;

var

Form3: TForm3;

CxW,CyW,X0W,Y0W:integer;

MashW:real;

PInter:array of TPoint;

implementation

uses Unit1,Unit2;

procedure TForm3.PaintIntersection;

var i:integer;

Nor:Vector;

C1,S1,x:real;

FG:array[1..1000] of Point;

begin

CxW:=(Form3.Width+Form3.GroupBox1.Width) div 2;

CyW:=(Form3.Height) div 2;

for i:=1 to E[M+1,0] do

FG[i]:=V[N+i];

Nor:=Form1.Normal(FG[1],FG[2],FG[3]);

if (Nor.y0) then

begin

C1:=Nor.z/sqrt(sqr(Nor.y)+sqr(Nor.z));

S1:=Nor.y/sqrt(sqr(Nor.y)+sqr(Nor.z));

end

else begin C1:=1; S1:=0 end;

for i:=1 to E[M+1,0] do

begin

x:=(FG[i].y*C1)-(FG[i].z*S1);

FG[i].z:=(FG[i].y*S1)+(FG[i].z*C1);

FG[i].y:=x;

end;

Nor:=Form1.Normal(FG[1],FG[2],FG[3]);

if (Nor.x0) then

begin

C1:=Nor.z/sqrt(sqr(Nor.x)+sqr(Nor.z));

S1:=Nor.x/sqrt(sqr(Nor.x)+sqr(Nor.z));

end

else begin C1:=1; S1:=0 end;

for i:=1 to E[M+1,0] do

begin

FG[i].x:=(FG[i].x*C1)-(FG[i].z*S1);

end;

SetLength(PInter,E[M+1,0]);

for i:=1 to E[M+1,0] do

begin

PInter[i-1].X:=round(CxW+(FG[i].x*MashW));

PInter[i-1].Y:=round(CyW-(FG[i].y*MashW));

end;

Form3.Canvas.Brush.Color:=ColorIntersection;

Form3.Canvas.Pen.Color:=ColorRebro;

Form3.Canvas.Polygon(PInter);

Form3.Canvas.Font.Height:=8;

Form3.Canvas.Brush.Style:=bsClear;

Form3.Canvas.Pen.Color:=clBlack;

for i:=1 to E[M+1,0] do

Form3.Canvas.TextOut(PInter[i-1].X,PInter[i-1].Y,S+inttostr(i));

end;

{$R *.dfm}

procedure TForm3.FormCreate(Sender: TObject);

function Ploshad(A,B,C:Point):real;

var i:integer;

Al,Bl,Cl,p:real;

begin

Al:=sqrt(sqr(A.x-B.x)+sqr(A.y-B.y)+sqr(A.z-B.z));

Bl:=sqrt(sqr(B.x-c.x)+sqr(B.y-C.y)+sqr(B.z-C.z));

Cl:=sqrt(sqr(C.x-A.x)+sqr(C.y-A.y)+sqr(C.z-A.z));

p:=(Al+Bl+Cl)/2;

Ploshad:=sqrt(p*(p-Al)*(p-Bl)*(p-Cl));

end;

var i:integer;

S:real;

begin

Form3.Caption:=Просмотр сечения. (+inttostr(E[M+1,0])+ угольник);

for i:=1 to E[M+1,0] do

Form3.ListBox1.Items[i-1]:=S+inttostr(i)+: +floattostrf(V[E[M+1,i]].x,ffGeneral,3,5)+; +floattostrf(V[E[M+1,i]].y,ffGeneral,3,5)+; +floattostrf(V[E[M+1,i]].z,ffGeneral,3,5);

Form3.Edit2.Text:=(+floattostrf(A,ffGeneral,3,5)+)*X+(+floattostrf(B,ffGeneral,3,5)+)*Y+(+floattostrf(C,ffGeneral,3,5)+)*Z+(+floattostrf(D,ffGeneral,3,5)+)+=0;

CxW:=(Form3.Width+Form3.GroupBox1.Width) div 2;

CyW:=(Form3.Height) div 2;

MashW:=Scene[4].M.Mash;

S:=0;

for i:=1 to E[M+1,0]-2 do

S:=S+Ploshad(V[M+1],V[M+i+1],V[M+i+2]);

Form3.Edit1.Text:=floattostrf(S,ffGeneral,3,5)+ Ед.Кв.;

end;

procedure TForm3.Edit2KeyPress(Sender: TObject; var Key: Char);

begin

Key:=#0;

end;

procedure TForm3.Edit1KeyPress(Sender: TObject; var Key: Char);

begin

Key:=#0;

end;

procedure TForm3.FormPaint(Sender: TObject);

begin

PaintIntersection;

end;

procedure TForm3.FormMouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

begin

if ssleft in shift then

begin

if MashW-(Y-Y0W)>0 then MashW:=MashW-(Y-Y0W) else ShowMessage(Масштаб: меньше нельзя!);

Form3.Repaint;

end;

X0W:=X; Y0W:=Y;

end;

procedure TForm3.BitBtn1Click(Sender: TObject);

begin

Form3.Close;

end;

end.

Список литературы

 

  1. Delphi 6. Справочное пособие. Архангельский А.Я. М.: ЗАО Издательство БИНОМ, 2001.
  2. Эффективная работа: 3ds max 4. Маров М. СПб.: Питер, 2002.
  3. Геометрия. В 2-х ч. Ч. I. Учебное пособие для студентов физ.-мат. фак. пед. ин-тов. Атанасян Л.С., Базылев В.Т. М.: Просвещение, 1986.

s