unit D3; interface uses graph, dos, crt; const zero: array[1..3]of longint=(0, 0, 0); V0: array[1..3]of real=(0, 0, 0); type DirVec=1..3; Vector = array[DirVec] of real; Point = array[DirVec] of longint; sPoint = array[DirVec] of integer; var O : Point; {Pozitia in Oxyz} Grvt : Point; {Vectorul gravitatiei} Lght : Point; Mv : Vector; {Vectorul acceleratiei} speed: integer; {Viteza de miscare} deeph: real; {Adancimea proiectiei centrale} a, b : real; {Unghiul orizontal si vertical de privire} miu : real; {Coeficientul de frecare} v: array[DirVec, DirVec] of real; {Matricea operatorului de transformare a coordonatelor} sa, sb, ca, cb: real; {sin si cos} TLi: Longint; TR: real; TS: String; TP: Point; {Temp} { //--- Calc Coord --- } procedure CalcSC; {Calcularea Sin Cos} procedure CalcVec; function PCrd(p: point; d: dirvec): longint; Function VCrd(p: vector; d: dirvec): real; Procedure PRot(pr: point; var pv: point); Procedure VRot(pr: vector; var pv: vector); { --- Calc Coord ---// } Procedure ProdVec(v1, v2: Point; var res: Point); {Produsul vectorial} Procedure MiniVec(p: Point; var res: vector); {Se obtine un vector cu coordonata maxima 1, paralel la p} Procedure vProdVec(v1, v2: Point; var res: vector); {Produsul vectorial, rezultatul de tip Vector, coordonata maxima 1} Procedure pGetPerp(p1, p2, p3: Point; var res: Point); {Se obtine un vector perpendicular la planul determinat de punctele p1, p2, p3} Procedure vGetPerp(p1, p2, p3: Point; var res: Vector); {Ca si pGetPerp, cu coordonata maxima 1} Procedure pGetPerpL(p1, p2, p3: Point; var res: Point; lng: longint); {Ca si pGetPerp, cu modulul lng} Procedure pGetPerpPoint(p1, p2, p3: Point; var res: Point; lng: longint); {Punctul situat la distanta lng de la planul determinat de p1, p2, p3} Procedure GetVecPar(v1: vector; L: LongInt; var res: point); {Obtinerea unui vector de tip Point, de modul L, paralel cu v1} Procedure GetVec(p1: Point; var v1: Vector); {Obtinerea unui vector de modul 1 paralel la p1} Procedure VecUnit(v1: vector; var res: vector); {Obtinerea unui vector cu modulul 1 din v1} Procedure PSum(v1, v2: Point; var res: Point); Procedure PDif(v1, v2: Point; var res: Point); Procedure vSum(v1, v2: Vector; var res: Vector); Procedure vDif(v1, v2: Vector; var res: Vector); Function pProd(v1, v2: Point): Longint; Function vProd(v1, v2: Vector): real; Function vpProd(v1: vector; p1: Point): Extended; function r(g: real): real; function g(r: real): real; Function DphP(v: real): real; Procedure Move(d: DirVec; st: integer); Procedure vMove(p: Vector); function Gravity(var Spd: Vector; var poz: Point; zer: longint): longint; Procedure CalcDynam; Function Dist(p1, p2: vector): real; Function vModul(p: Vector): extended; Function PModul(p: point): real; Procedure vWrite(v1: vector); Procedure pWrite(v1: point); implementation var i, j, k: LongInt; bt: byte; Procedure vWrite; begin for bt:=1to 3 do write(v1[bt]: 10: 2, ' '); writeln; end; Procedure pWrite; begin for bt:=1to 3 do write(v1[bt]: 10, ' '); writeln; end; Procedure GetVecPar; var l1, l2: real; begin l2:=vModul(v1); if(l2<>0)then begin l1:=l/l2; for bt:=1 to 3 do begin res[bt]:=round(v1[bt]*l1); end; end; end; Procedure GetVec(p1: Point; var v1: Vector); var l: real; begin l:=pModul(p1); if(l<>0)then begin for bt:=1 to 3 do begin v1[bt]:=(p1[bt]/l); end; end; end; Procedure VecUnit(v1: vector; var res: vector); var l: real; begin l:=vModul(v1); if(l<>0)then begin for bt:=1 to 3 do begin res[bt]:=(v1[bt]/l); end; end; end; Procedure ProdVec(v1, v2: Point; var res: Point); begin res[1] := v1[2]*v2[3] - v2[2]*v1[3]; res[2] := v1[3]*v2[1] - v2[3]*v1[1]; res[3] := v1[1]*v2[2] - v2[1]*v1[2]; end; Procedure MiniVec; var i, j: byte; begin res:=v0; j:=1; for i:=1 to 3 do if p[i]>p[j] then j:=i; if(j<3)and(p[j]
zer then Spd[2] := Spd[2]+grvt[2] else
// if poz[2]