Skip to content

Commit

Permalink
* Более точная CalcAABBInFrustum (старый вариант, хз когда и зачем я …
Browse files Browse the repository at this point in the history
…от него отказался)
  • Loading branch information
zamtmn committed Jan 24, 2025
1 parent 771a4d8 commit 6eb9902
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions cad_source/components/zmath/uzegeometry.pas
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ function CalcPointTrueInFrustum (const lbegin:GDBvertex; const frustum:ClipArray
function CalcAABBInFrustum (const AABB:TBoundingBox;
const frustum:ClipArray):TInBoundingVolume;
var
i{,Count}:integer;
i,Count:integer;
p1,p2,p3,p4,p5,p6,p7,p8:GDBvertex;
d1,d2,d3,d4,d5,d6,d7,d8:double;
begin
Expand All @@ -684,7 +684,7 @@ function CalcAABBInFrustum (const AABB:TBoundingBox;
p7:=AABB.RTF;
p8:=CreateVertex(AABB.LBN.x,AABB.RTF.y,AABB.RTF.Z);

//Count:=0;
Count:=0;
for i:=0 to 5 do begin
with frustum[i] do begin
d1:=v[0] * p1.x + v[1] * p1.y + v[2] * p1.z + v[3];
Expand All @@ -703,26 +703,26 @@ function CalcAABBInFrustum (const AABB:TBoundingBox;
system.exit;
end;

if (d1<0)or(d2<0)or(d3<0)or(d4<0)or(d5<0)or(d6<0)or
{if (d1<0)or(d2<0)or(d3<0)or(d4<0)or(d5<0)or(d6<0)or
(d7<0)or(d8<0) then begin
Result:=IRPartially;
system.exit;
end;

//if d1>=0 then Inc(Count);
//if d2>=0 then Inc(Count);
//if d3>=0 then Inc(Count);
//if d4>=0 then Inc(Count);
//if d5>=0 then Inc(Count);
//if d6>=0 then Inc(Count);
//if d7>=0 then Inc(Count);
//if d8>=0 then Inc(Count);
end;}

if d1>=0 then Inc(Count);
if d2>=0 then Inc(Count);
if d3>=0 then Inc(Count);
if d4>=0 then Inc(Count);
if d5>=0 then Inc(Count);
if d6>=0 then Inc(Count);
if d7>=0 then Inc(Count);
if d8>=0 then Inc(Count);
end;
//Result:=irfully;
Result:=IRPartially;
if Count=48 then begin
Result:=irfully;
end;
Result:=irfully;
//if Count=48 then begin
// Result:=irfully;
// exit;
//end;
//Result:=IRPartially;
end;
function PointOf3PlaneIntersect(const P1,P2,P3:DVector4D):GDBvertex;
Expand Down

0 comments on commit 6eb9902

Please sign in to comment.