CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csgeom/box.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 1998-2002 by Jorrit Tyberghein
00003     Largely rewritten by Ivan Avramovic <ivan@avramovic.com>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_BOX_H__
00021 #define __CS_BOX_H__
00022 
00030 #include "csextern.h"
00031 
00032 #include "cstypes.h"    // for bool
00033 #include "csrect.h"
00034 #include "vector2.h"
00035 #include "vector3.h"
00036 #include "segment.h"
00037 
00038 class csPlane3;
00039 class csTransform;
00040 class csPoly2D;
00041 
00046 #define CS_BOUNDINGBOX_MAXVALUE 1000000000.
00047 
00051 
00052 #define CS_BOX_CORNER_xy 0
00053 
00054 #define CS_BOX_CORNER_xY 1
00055 
00056 #define CS_BOX_CORNER_Xy 2
00057 
00058 #define CS_BOX_CORNER_XY 3
00059 
00060 #define CS_BOX_CENTER2 4
00061 
00067 
00068 #define CS_BOX_EDGE_xy_Xy 0
00069 
00070 #define CS_BOX_EDGE_Xy_xy 1
00071 
00072 #define CS_BOX_EDGE_Xy_XY 2
00073 
00074 #define CS_BOX_EDGE_XY_Xy 3
00075 
00076 #define CS_BOX_EDGE_XY_xY 4
00077 
00078 #define CS_BOX_EDGE_xY_XY 5
00079 
00080 #define CS_BOX_EDGE_xY_xy 6
00081 
00082 #define CS_BOX_EDGE_xy_xY 7
00083 
00092 class CS_CSGEOM_EXPORT csBox2
00093 {
00094 private:
00095   struct bEdge
00096   {
00097     uint8 v1, v2;       // Indices of vertex in bounding box (CS_BOX_CORNER_...)
00098   };
00099   // Index by edge number. Edge e and e+1 with e even are opposite edges.
00100   // (CS_BOX_EDGE_...)
00101   static bEdge edges[8];
00102 
00103 protected:
00105   csVector2 minbox;
00107   csVector2 maxbox;
00108 
00109 public:
00111   float MinX () const { return minbox.x; }
00113   float MinY () const { return minbox.y; }
00115   float MaxX () const { return maxbox.x; }
00117   float MaxY () const { return maxbox.y; }
00119   float Min (int idx) const { return idx ? minbox.y : minbox.x; }
00121   float Max (int idx) const { return idx ? maxbox.y : maxbox.x; }
00123   const csVector2& Min () const { return minbox; }
00125   const csVector2& Max () const { return maxbox; }
00126 
00135   csVector2 GetCorner (int corner) const;
00136 
00140   csVector2 GetCenter () const { return (minbox+maxbox)/2; }
00141 
00146   void SetCenter (const csVector2& c);
00147 
00151   void SetSize (const csVector2& s);
00152 
00157   void GetEdgeInfo (int edge, int& v1, int& v2) const
00158   {
00159     v1 = edges[edge].v1;
00160     v2 = edges[edge].v2;
00161   }
00162 
00167   csSegment2 GetEdge (int edge) const
00168   {
00169     return csSegment2 (GetCorner (edges[edge].v1), GetCorner (edges[edge].v2));
00170   }
00171 
00176   void GetEdge (int edge, csSegment2& e) const
00177   {
00178     e.SetStart (GetCorner (edges[edge].v1));
00179     e.SetEnd (GetCorner (edges[edge].v2));
00180   }
00181 
00188   static bool Intersect (float minx, float miny, float maxx, float maxy,
00189     csVector2* poly, int num_poly);
00190 
00197   static bool Intersect (const csVector2& minbox, const csVector2& maxbox,
00198     csVector2* poly, int num_poly)
00199   {
00200     return Intersect (minbox.x, minbox.y, maxbox.x, maxbox.y, poly, num_poly);
00201   }
00202 
00209   bool Intersect (csVector2* poly, int num_poly) const
00210   {
00211     return Intersect (minbox, maxbox, poly, num_poly);
00212   }
00213 
00215   bool In (float x, float y) const
00216   {
00217     if (x < minbox.x || x > maxbox.x) return false;
00218     if (y < minbox.y || y > maxbox.y) return false;
00219     return true;
00220   }
00221 
00223   bool In (const csVector2& v) const
00224   {
00225     return In (v.x, v.y);
00226   }
00227 
00229   bool Overlap (const csBox2& box) const
00230   {
00231     if (maxbox.x < box.minbox.x || minbox.x > box.maxbox.x) return false;
00232     if (maxbox.y < box.minbox.y || minbox.y > box.maxbox.y) return false;
00233     return true;
00234   }
00235 
00237   bool Contains (const csBox2& box) const
00238   {
00239     return (box.minbox.x >= minbox.x && box.maxbox.x <= maxbox.x) &&
00240            (box.minbox.y >= minbox.y && box.maxbox.y <= maxbox.y);
00241   }
00242 
00244   bool Empty () const
00245   {
00246     if (minbox.x > maxbox.x) return true;
00247     if (minbox.y > maxbox.y) return true;
00248     return false;
00249   }
00250 
00255   float SquaredOriginDist () const;
00256 
00262   float SquaredOriginMaxDist () const;
00263 
00265   void StartBoundingBox ()
00266   {
00267     minbox.x =  CS_BOUNDINGBOX_MAXVALUE;  minbox.y =  CS_BOUNDINGBOX_MAXVALUE;
00268     maxbox.x = -CS_BOUNDINGBOX_MAXVALUE;  maxbox.y = -CS_BOUNDINGBOX_MAXVALUE;
00269   }
00270 
00272   void StartBoundingBox (const csVector2& v)
00273   {
00274     minbox = v;
00275     maxbox = v;
00276   }
00277 
00279   void StartBoundingBox (float x, float y)
00280   {
00281     minbox.x = maxbox.x = x;
00282     minbox.y = maxbox.y = y;
00283   }
00284 
00286   void AddBoundingVertex (float x, float y)
00287   {
00288     if (x < minbox.x) minbox.x = x;  if (x > maxbox.x) maxbox.x = x;
00289     if (y < minbox.y) minbox.y = y;  if (y > maxbox.y) maxbox.y = y;
00290   }
00291 
00293   void AddBoundingVertex (const csVector2& v)
00294   {
00295     AddBoundingVertex (v.x, v.y);
00296   }
00297 
00303   void AddBoundingVertexSmart (float x, float y)
00304   {
00305     if (x < minbox.x) minbox.x = x; else if (x > maxbox.x) maxbox.x = x;
00306     if (y < minbox.y) minbox.y = y; else if (y > maxbox.y) maxbox.y = y;
00307   }
00308 
00314   void AddBoundingVertexSmart (const csVector2& v)
00315   {
00316     AddBoundingVertexSmart (v.x, v.y);
00317   }
00318 
00323   bool AddBoundingVertexTest (float x, float y)
00324   {
00325     bool rc = false;
00326     if (x < minbox.x) { minbox.x = x; rc = true; }
00327     if (x > maxbox.x) { maxbox.x = x; rc = true; }
00328     if (y < minbox.y) { minbox.y = y; rc = true; }
00329     if (y > maxbox.y) { maxbox.y = y; rc = true; }
00330     return rc;
00331   }
00332 
00337   bool AddBoundingVertexTest (const csVector2& v)
00338   {
00339     return AddBoundingVertexTest (v.x, v.y);
00340   }
00341 
00348   bool AddBoundingVertexSmartTest (float x, float y)
00349   {
00350     bool rc = false;
00351     if (x < minbox.x) { minbox.x = x; rc = true; }
00352     else if (x > maxbox.x) { maxbox.x = x; rc = true; }
00353     if (y < minbox.y) { minbox.y = y; rc = true; }
00354     else if (y > maxbox.y) { maxbox.y = y; rc = true; }
00355     return rc;
00356   }
00357 
00364   bool AddBoundingVertexSmartTest (const csVector2& v)
00365   {
00366     return AddBoundingVertexSmartTest (v.x, v.y);
00367   }
00368 
00369   //-----
00370   // Maintenance Note: The csBox2 constructors and Set() appear at this point
00371   // in the file, rather than earlier, in order to appease the OpenStep 4.2
00372   // compiler.  Specifically, the problem is that the compiler botches code
00373   // generation if an unseen method (which is later declared inline) is
00374   // called from within another inline method.  For instance, if the
00375   // constructors were listed at the top of the file, rather than here, the
00376   // compiler would see calls to Empty() and StartBoundingBox() before seeing
00377   // declarations for them.  In such a situation, the buggy compiler
00378   // generates a broken object file.  The simple work-around of textually
00379   // reorganizing the file ensures that the declarations for Empty() and
00380   // StartBoundingBox() are seen before they are called.
00381   //-----
00382 
00384   csBox2 () : minbox (CS_BOUNDINGBOX_MAXVALUE, CS_BOUNDINGBOX_MAXVALUE),
00385              maxbox (-CS_BOUNDINGBOX_MAXVALUE, -CS_BOUNDINGBOX_MAXVALUE) {}
00386 
00388   csBox2 (const csVector2& v) : minbox (v.x, v.y), maxbox (v.x, v.y) {}
00389 
00391   csBox2 (float x1, float y1, float x2, float y2) :
00392     minbox (x1, y1), maxbox (x2, y2)
00393   { if (Empty ()) StartBoundingBox (); }
00394 
00396   csBox2 (const csRect& r) : minbox (r.xmin, r.ymin), maxbox (r.xmax, r.ymax)
00397   { }
00398   
00400   void Set (const csVector2& bmin, const csVector2& bmax)
00401   {
00402     minbox = bmin;
00403     maxbox = bmax;
00404   }
00405 
00407   void Set (float x1, float y1, float x2, float y2)
00408   {
00409     if (x1>x2 || y1>y2) StartBoundingBox();
00410     else { minbox.x = x1;  minbox.y = y1;  maxbox.x = x2;  maxbox.y = y2; }
00411   }
00412 
00414   void SetMin (int idx, float val)
00415   {
00416     if (idx == 1) minbox.y = val;
00417     else minbox.x = val;
00418   }
00419 
00421   void SetMax (int idx, float val)
00422   {
00423     if (idx == 1) maxbox.y = val;
00424     else maxbox.x = val;
00425   }
00426 
00428   csBox2& operator+= (const csBox2& box);
00430   csBox2& operator+= (const csVector2& point);
00432   csBox2& operator*= (const csBox2& box);
00434   bool TestIntersect (const csBox2& box) const;
00435 
00437   friend csBox2 operator+ (const csBox2& box1, const csBox2& box2);
00439   friend csBox2 operator+ (const csBox2& box, const csVector2& point);
00441   friend csBox2 operator* (const csBox2& box1, const csBox2& box2);
00442 
00444   friend bool operator== (const csBox2& box1, const csBox2& box2);
00446   friend bool operator!= (const csBox2& box1, const csBox2& box2);
00448   friend bool operator< (const csBox2& box1, const csBox2& box2);
00450   friend bool operator> (const csBox2& box1, const csBox2& box2);
00452   friend bool operator< (const csVector2& point, const csBox2& box);
00453 };
00454 
00459 
00460 #define CS_BOX_CORNER_xyz 0
00461 
00462 #define CS_BOX_CORNER_xyZ 1
00463 
00464 #define CS_BOX_CORNER_xYz 2
00465 
00466 #define CS_BOX_CORNER_xYZ 3
00467 
00468 #define CS_BOX_CORNER_Xyz 4
00469 
00470 #define CS_BOX_CORNER_XyZ 5
00471 
00472 #define CS_BOX_CORNER_XYz 6
00473 
00474 #define CS_BOX_CORNER_XYZ 7
00475 
00476 #define CS_BOX_CENTER3 8
00477 
00483 
00484 #define CS_BOX_SIDE_x 0
00485 
00486 #define CS_BOX_SIDE_X 1
00487 
00488 #define CS_BOX_SIDE_y 2
00489 
00490 #define CS_BOX_SIDE_Y 3
00491 
00492 #define CS_BOX_SIDE_z 4
00493 
00494 #define CS_BOX_SIDE_Z 5
00495 
00496 #define CS_BOX_INSIDE 6
00497 
00503 
00504 #define CS_BOX_EDGE_Xyz_xyz 0
00505 
00506 #define CS_BOX_EDGE_xyz_Xyz 1
00507 
00508 #define CS_BOX_EDGE_xyz_xYz 2
00509 
00510 #define CS_BOX_EDGE_xYz_xyz 3
00511 
00512 #define CS_BOX_EDGE_xYz_XYz 4
00513 
00514 #define CS_BOX_EDGE_XYz_xYz 5
00515 
00516 #define CS_BOX_EDGE_XYz_Xyz 6
00517 
00518 #define CS_BOX_EDGE_Xyz_XYz 7
00519 
00520 #define CS_BOX_EDGE_Xyz_XyZ 8
00521 
00522 #define CS_BOX_EDGE_XyZ_Xyz 9
00523 
00524 #define CS_BOX_EDGE_XyZ_XYZ 10
00525 
00526 #define CS_BOX_EDGE_XYZ_XyZ 11
00527 
00528 #define CS_BOX_EDGE_XYZ_XYz 12
00529 
00530 #define CS_BOX_EDGE_XYz_XYZ 13
00531 
00532 #define CS_BOX_EDGE_XYZ_xYZ 14
00533 
00534 #define CS_BOX_EDGE_xYZ_XYZ 15
00535 
00536 #define CS_BOX_EDGE_xYZ_xYz 16
00537 
00538 #define CS_BOX_EDGE_xYz_xYZ 17
00539 
00540 #define CS_BOX_EDGE_xYZ_xyZ 18
00541 
00542 #define CS_BOX_EDGE_xyZ_xYZ 19
00543 
00544 #define CS_BOX_EDGE_xyZ_xyz 20
00545 
00546 #define CS_BOX_EDGE_xyz_xyZ 21
00547 
00548 #define CS_BOX_EDGE_xyZ_XyZ 22
00549 
00550 #define CS_BOX_EDGE_XyZ_xyZ 23
00551 
00560 class CS_CSGEOM_EXPORT csBox3
00561 {
00562 protected:
00564   csVector3 minbox;
00566   csVector3 maxbox;
00568   struct bEdge
00569   {
00570     uint8 v1, v2; // Indices of vertex in bounding box (CS_BOX_CORNER_...)
00571     uint8 fl, fr; // Indices of left/right faces sharing edge (CS_BOX_SIDE_...)
00572   };
00574   typedef uint8 bFace[4];       
00579   static bEdge edges[24];
00581   static bFace faces[6];
00582 public:
00584   float MinX () const { return minbox.x; }
00586   float MinY () const { return minbox.y; }
00588   float MinZ () const { return minbox.z; }
00590   float MaxX () const { return maxbox.x; }
00592   float MaxY () const { return maxbox.y; }
00594   float MaxZ () const { return maxbox.z; }
00596   float Min (int idx) const
00597   { return idx == 1 ? minbox.y : idx == 0 ? minbox.x : minbox.z; }
00599   float Max (int idx) const
00600   { return idx == 1 ? maxbox.y : idx == 0 ? maxbox.x : maxbox.z; }
00602   const csVector3& Min () const { return minbox; }
00604   const csVector3& Max () const { return maxbox; }
00605 
00615   csVector3 GetCorner (int corner) const;
00616 
00621   void GetEdgeInfo (int edge, int& v1, int& v2, int& fleft, int& fright) const
00622   {
00623     v1 = edges[edge].v1;
00624     v2 = edges[edge].v2;
00625     fleft = edges[edge].fl;
00626     fright = edges[edge].fr;
00627   }
00628 
00633   uint8* GetFaceEdges (int face) const
00634   {
00635     return faces[face];
00636   }
00637 
00641   csVector3 GetCenter () const { return (minbox+maxbox)/2; }
00642 
00647   void SetCenter (const csVector3& c);
00648 
00652   void SetSize (const csVector3& s);
00653 
00658   csBox2 GetSide (int side) const;
00659 
00666   int GetVisibleSides (const csVector3& pos, int* visible_sides) const;
00667 
00672   static int OtherSide (int side)
00673   {
00674     return side ^ 1;
00675   }
00676 
00682   csSegment3 GetEdge (int edge) const
00683   {
00684     return csSegment3 (GetCorner (edges[edge].v1), GetCorner (edges[edge].v2));
00685   }
00686 
00692   void GetEdge (int edge, csSegment3& e) const
00693   {
00694     e.SetStart (GetCorner (edges[edge].v1));
00695     e.SetEnd (GetCorner (edges[edge].v2));
00696   }
00697 
00699   bool In (float x, float y, float z) const
00700   {
00701     if (x < minbox.x || x > maxbox.x) return false;
00702     if (y < minbox.y || y > maxbox.y) return false;
00703     if (z < minbox.z || z > maxbox.z) return false;
00704     return true;
00705   }
00706 
00708   bool In (const csVector3& v) const
00709   {
00710     return In (v.x, v.y, v.z);
00711   }
00712 
00714   bool Overlap (const csBox3& box) const
00715   {
00716     if (maxbox.x < box.minbox.x || minbox.x > box.maxbox.x) return false;
00717     if (maxbox.y < box.minbox.y || minbox.y > box.maxbox.y) return false;
00718     if (maxbox.z < box.minbox.z || minbox.z > box.maxbox.z) return false;
00719     return true;
00720   }
00721 
00723   bool Contains (const csBox3& box) const
00724   {
00725     return (box.minbox.x >= minbox.x && box.maxbox.x <= maxbox.x) &&
00726            (box.minbox.y >= minbox.y && box.maxbox.y <= maxbox.y) &&
00727            (box.minbox.z >= minbox.z && box.maxbox.z <= maxbox.z);
00728   }
00729 
00731   bool Empty () const
00732   {
00733     if (minbox.x > maxbox.x) return true;
00734     if (minbox.y > maxbox.y) return true;
00735     if (minbox.z > maxbox.z) return true;
00736     return false;
00737   }
00738 
00740   void StartBoundingBox ()
00741   {
00742     minbox.x =  CS_BOUNDINGBOX_MAXVALUE;
00743     minbox.y =  CS_BOUNDINGBOX_MAXVALUE;
00744     minbox.z =  CS_BOUNDINGBOX_MAXVALUE;
00745     maxbox.x = -CS_BOUNDINGBOX_MAXVALUE;
00746     maxbox.y = -CS_BOUNDINGBOX_MAXVALUE;
00747     maxbox.z = -CS_BOUNDINGBOX_MAXVALUE;
00748   }
00749 
00751   void StartBoundingBox (const csVector3& v)
00752   {
00753     minbox = v; maxbox = v;
00754   }
00755 
00757   void AddBoundingVertex (float x, float y, float z)
00758   {
00759     if (x < minbox.x) minbox.x = x; if (x > maxbox.x) maxbox.x = x;
00760     if (y < minbox.y) minbox.y = y; if (y > maxbox.y) maxbox.y = y;
00761     if (z < minbox.z) minbox.z = z; if (z > maxbox.z) maxbox.z = z;
00762   }
00763 
00765   void AddBoundingVertex (const csVector3& v)
00766   {
00767     AddBoundingVertex (v.x, v.y, v.z);
00768   }
00769 
00775   void AddBoundingVertexSmart (float x, float y, float z)
00776   {
00777     if (x < minbox.x) minbox.x = x; else if (x > maxbox.x) maxbox.x = x;
00778     if (y < minbox.y) minbox.y = y; else if (y > maxbox.y) maxbox.y = y;
00779     if (z < minbox.z) minbox.z = z; else if (z > maxbox.z) maxbox.z = z;
00780   }
00781 
00787   void AddBoundingVertexSmart (const csVector3& v)
00788   {
00789     AddBoundingVertexSmart (v.x, v.y, v.z);
00790   }
00791 
00796   bool AddBoundingVertexTest (float x, float y, float z)
00797   {
00798     bool rc = false;
00799     if (x < minbox.x) { minbox.x = x; rc = true; }
00800     if (x > maxbox.x) { maxbox.x = x; rc = true; }
00801     if (y < minbox.y) { minbox.y = y; rc = true; }
00802     if (y > maxbox.y) { maxbox.y = y; rc = true; }
00803     if (z < minbox.z) { minbox.z = z; rc = true; }
00804     if (z > maxbox.z) { maxbox.z = z; rc = true; }
00805     return rc;
00806   }
00807 
00812   bool AddBoundingVertexTest (const csVector3& v)
00813   {
00814     return AddBoundingVertexTest (v.x, v.y, v.z);
00815   }
00816 
00823   bool AddBoundingVertexSmartTest (float x, float y, float z)
00824   {
00825     bool rc = false;
00826     if (x < minbox.x) { minbox.x = x; rc = true; }
00827     else if (x > maxbox.x) { maxbox.x = x; rc = true; }
00828     if (y < minbox.y) { minbox.y = y; rc = true; }
00829     else if (y > maxbox.y) { maxbox.y = y; rc = true; }
00830     if (z < minbox.z) { minbox.z = z; rc = true; }
00831     else if (z > maxbox.z) { maxbox.z = z; rc = true; }
00832     return rc;
00833   }
00834 
00841   bool AddBoundingVertexSmartTest (const csVector3& v)
00842   {
00843     return AddBoundingVertexSmartTest (v.x, v.y, v.z);
00844   }
00845 
00846   //-----
00847   // Maintenance Note: The csBox3 constructors and Set() appear at this point
00848   // in the file, rather than earlier, in order to appease the OpenStep 4.2
00849   // compiler.  Specifically, the problem is that the compiler botches code
00850   // generation if an unseen method (which is later declared inline) is
00851   // called from within another inline method.  For instance, if the
00852   // constructors were listed at the top of the file, rather than here, the
00853   // compiler would see calls to Empty() and StartBoundingBox() before seeing
00854   // declarations for them.  In such a situation, the buggy compiler
00855   // generated a broken object file.  The simple work-around of textually
00856   // reorganizing the file ensures that the declarations for Empty() and
00857   // StartBoundingBox() are seen before they are called.
00858   //-----
00859 
00861   csBox3 () :
00862     minbox ( CS_BOUNDINGBOX_MAXVALUE,
00863              CS_BOUNDINGBOX_MAXVALUE,
00864              CS_BOUNDINGBOX_MAXVALUE),
00865     maxbox (-CS_BOUNDINGBOX_MAXVALUE,
00866             -CS_BOUNDINGBOX_MAXVALUE,
00867             -CS_BOUNDINGBOX_MAXVALUE) {}
00868 
00870   csBox3 (const csVector3& v) : minbox (v), maxbox (v) { }
00871 
00873   csBox3 (const csVector3& v1, const csVector3& v2) :
00874         minbox (v1), maxbox (v2)
00875   { if (Empty ()) StartBoundingBox (); }
00876 
00878   csBox3 (float x1, float y1, float z1, float x2, float y2, float z2) :
00879     minbox (x1, y1, z1), maxbox (x2, y2, z2)
00880   { if (Empty ()) StartBoundingBox (); }
00881 
00883   void Set (const csVector3& bmin, const csVector3& bmax)
00884   {
00885     minbox = bmin;
00886     maxbox = bmax;
00887   }
00888 
00890   void Set (float x1, float y1, float z1, float x2, float y2, float z2)
00891   {
00892     if (x1>x2 || y1>y2 || z1>z2) StartBoundingBox();
00893     else
00894     {
00895       minbox.x = x1; minbox.y = y1; minbox.z = z1;
00896       maxbox.x = x2; maxbox.y = y2; maxbox.z = z2;
00897     }
00898   }
00899 
00901   void SetMin (int idx, float val)
00902   {
00903     if (idx == 1) minbox.y = val;
00904     else if (idx == 0) minbox.x = val;
00905     else minbox.z = val;
00906   }
00907 
00909   void SetMax (int idx, float val)
00910   {
00911     if (idx == 1) maxbox.y = val;
00912     else if (idx == 0) maxbox.x = val;
00913     else maxbox.z = val;
00914   }
00915 
00919   bool AdjacentX (const csBox3& other) const;
00920 
00924   bool AdjacentY (const csBox3& other) const;
00925 
00929   bool AdjacentZ (const csBox3& other) const;
00930 
00937   int Adjacent (const csBox3& other) const;
00938 
00945   int CalculatePointSegment (const csVector3& pos) const;
00946 
00955   void GetConvexOutline (const csVector3& pos,
00956         csVector3* array, int& num_array, bool bVisible=false) const;
00957 
00961   bool Between (const csBox3& box1, const csBox3& box2) const;
00962 
00967   void ManhattanDistance (const csBox3& other, csVector3& dist) const;
00968 
00973   float SquaredOriginDist () const;
00974 
00980   float SquaredOriginMaxDist () const;
00981 
00993   bool ProjectBox (const csTransform& trans, float fov, float sx, float sy,
00994         csBox2& sbox, float& min_z, float& max_z) const;
00995 
01005   bool ProjectOutline (const csTransform& trans, float fov, float sx, float sy,
01006         csPoly2D& poly, float& min_z, float& max_z) const;
01007 
01020   bool ProjectBoxAndOutline (const csTransform& trans, float fov,
01021         float sx, float sy, csBox2& sbox, csPoly2D& poly,
01022         float& min_z, float& max_z) const;
01023 
01025   csBox3& operator+= (const csBox3& box);
01027   csBox3& operator+= (const csVector3& point);
01029   csBox3& operator*= (const csBox3& box);
01031   bool TestIntersect (const csBox3& box) const;
01032 
01034   friend CS_CSGEOM_EXPORT csBox3 operator+ (const csBox3& box1, 
01035     const csBox3& box2);
01037   friend CS_CSGEOM_EXPORT csBox3 operator+ (const csBox3& box, 
01038     const csVector3& point);
01040   friend CS_CSGEOM_EXPORT csBox3 operator* (const csBox3& box1, 
01041     const csBox3& box2);
01042 
01044   friend CS_CSGEOM_EXPORT bool operator== (const csBox3& box1, 
01045     const csBox3& box2);
01047   friend CS_CSGEOM_EXPORT bool operator!= (const csBox3& box1, 
01048     const csBox3& box2);
01050   friend CS_CSGEOM_EXPORT bool operator< (const csBox3& box1, 
01051     const csBox3& box2);
01053   friend CS_CSGEOM_EXPORT bool operator> (const csBox3& box1, 
01054     const csBox3& box2);
01056   friend CS_CSGEOM_EXPORT bool operator< (const csVector3& point, 
01057     const csBox3& box);
01058 };
01059 
01062 #endif // __CS_BOX_H__

Generated for Crystal Space by doxygen 1.2.18