Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ForestGeneratorRectangle.c
Go to the documentation of this file.
2{
7 ref array<SCR_ForestGeneratorLine> m_aLines = {}; // outline lines that intersect this rectangle
8 ref array<vector> m_aPoints = {}; // points of this rectangle
9 ref array<IEntitySource> m_aPresentRoadShapes = {};
10 float m_fWidth;
11 float m_fLength;
12 float m_fArea;
13 int m_iX;
14 int m_iY;
15
16 //------------------------------------------------------------------------------------------------
19 void GetBounds(out vector mins, out vector maxs)
20 {
21 array<vector> points = {};
22 points.Insert(m_Line1.p1.m_vPos);
23 points.Insert(m_Line1.p2.m_vPos);
24 points.Insert(m_Line2.p2.m_vPos);
25 points.Insert(m_Line3.p2.m_vPos);
26 float minX = float.MAX;
27 float maxX = -float.MAX;
28 float minZ = float.MAX;
29 float maxZ = -float.MAX;
30
31 foreach (vector point : points)
32 {
33 if (point[0] < minX)
34 minX = point[0];
35
36 if (point[0] > maxX)
37 maxX = point[0];
38
39 if (point[2] < minZ)
40 minZ = point[2];
41
42 if (point[2] > maxZ)
43 maxZ = point[2];
44 }
45
46 mins[0] = minX;
47 mins[2] = minZ;
48 maxs[0] = maxX;
49 maxs[2] = maxZ;
50 }
51}