Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
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 #include "csutil/array.h" 00039 #include "csutil/csstring.h" 00040 00041 class csPlane3; 00042 class csTransform; 00043 class csPoly2D; 00044 00049 #define CS_BOUNDINGBOX_MAXVALUE 1000000000. 00050 00054 00055 #define CS_BOX_CORNER_xy 0 00056 00057 #define CS_BOX_CORNER_xY 1 00058 00059 #define CS_BOX_CORNER_Xy 2 00060 00061 #define CS_BOX_CORNER_XY 3 00062 00063 #define CS_BOX_CENTER2 4 00064 00070 00071 #define CS_BOX_EDGE_xy_Xy 0 00072 00073 #define CS_BOX_EDGE_Xy_xy 1 00074 00075 #define CS_BOX_EDGE_Xy_XY 2 00076 00077 #define CS_BOX_EDGE_XY_Xy 3 00078 00079 #define CS_BOX_EDGE_XY_xY 4 00080 00081 #define CS_BOX_EDGE_xY_XY 5 00082 00083 #define CS_BOX_EDGE_xY_xy 6 00084 00085 #define CS_BOX_EDGE_xy_xY 7 00086 00095 class CS_CSGEOM_EXPORT csBox2 00096 { 00097 private: 00098 struct bEdge 00099 { 00100 uint8 v1, v2; // Indices of vertex in bounding box (CS_BOX_CORNER_...) 00101 }; 00102 // Index by edge number. Edge e and e+1 with e even are opposite edges. 00103 // (CS_BOX_EDGE_...) 00104 static bEdge edges[8]; 00105 00106 protected: 00108 csVector2 minbox; 00110 csVector2 maxbox; 00111 00112 public: 00114 float MinX () const { return minbox.x; } 00116 float MinY () const { return minbox.y; } 00118 float MaxX () const { return maxbox.x; } 00120 float MaxY () const { return maxbox.y; } 00122 float Min (int idx) const { return idx ? minbox.y : minbox.x; } 00124 float Max (int idx) const { return idx ? maxbox.y : maxbox.x; } 00126 const csVector2& Min () const { return minbox; } 00128 const csVector2& Max () const { return maxbox; } 00129 00138 csVector2 GetCorner (int corner) const; 00139 00143 csVector2 GetCenter () const { return (minbox+maxbox)/2; } 00144 00149 void SetCenter (const csVector2& c); 00150 00154 void SetSize (const csVector2& s); 00155 00160 void GetEdgeInfo (int edge, int& v1, int& v2) const 00161 { 00162 v1 = edges[edge].v1; 00163 v2 = edges[edge].v2; 00164 } 00165 00170 csSegment2 GetEdge (int edge) const 00171 { 00172 return csSegment2 (GetCorner (edges[edge].v1), GetCorner (edges[edge].v2)); 00173 } 00174 00179 void GetEdge (int edge, csSegment2& e) const 00180 { 00181 e.SetStart (GetCorner (edges[edge].v1)); 00182 e.SetEnd (GetCorner (edges[edge].v2)); 00183 } 00184 00191 static bool Intersect (float minx, float miny, float maxx, float maxy, 00192 csVector2* poly, int num_poly); 00193 00200 static bool Intersect (const csVector2& minbox, const csVector2& maxbox, 00201 csVector2* poly, int num_poly) 00202 { 00203 return Intersect (minbox.x, minbox.y, maxbox.x, maxbox.y, poly, num_poly); 00204 } 00205 00212 bool Intersect (csVector2* poly, int num_poly) const 00213 { 00214 return Intersect (minbox, maxbox, poly, num_poly); 00215 } 00216 00218 bool In (float x, float y) const 00219 { 00220 if (x < minbox.x || x > maxbox.x) return false; 00221 if (y < minbox.y || y > maxbox.y) return false; 00222 return true; 00223 } 00224 00226 bool In (const csVector2& v) const 00227 { 00228 return In (v.x, v.y); 00229 } 00230 00232 bool Overlap (const csBox2& box) const 00233 { 00234 if (maxbox.x < box.minbox.x || minbox.x > box.maxbox.x) return false; 00235 if (maxbox.y < box.minbox.y || minbox.y > box.maxbox.y) return false; 00236 return true; 00237 } 00238 00240 bool Contains (const csBox2& box) const 00241 { 00242 return (box.minbox.x >= minbox.x && box.maxbox.x <= maxbox.x) && 00243 (box.minbox.y >= minbox.y && box.maxbox.y <= maxbox.y); 00244 } 00245 00247 bool Empty () const 00248 { 00249 if (minbox.x > maxbox.x) return true; 00250 if (minbox.y > maxbox.y) return true; 00251 return false; 00252 } 00253 00258 float SquaredOriginDist () const; 00259 00265 float SquaredOriginMaxDist () const; 00266 00268 void StartBoundingBox () 00269 { 00270 minbox.x = CS_BOUNDINGBOX_MAXVALUE; minbox.y = CS_BOUNDINGBOX_MAXVALUE; 00271 maxbox.x = -CS_BOUNDINGBOX_MAXVALUE; maxbox.y = -CS_BOUNDINGBOX_MAXVALUE; 00272 } 00273 00275 void StartBoundingBox (const csVector2& v) 00276 { 00277 minbox = v; 00278 maxbox = v; 00279 } 00280 00282 void StartBoundingBox (float x, float y) 00283 { 00284 minbox.x = maxbox.x = x; 00285 minbox.y = maxbox.y = y; 00286 } 00287 00289 void AddBoundingVertex (float x, float y) 00290 { 00291 if (x < minbox.x) minbox.x = x; if (x > maxbox.x) maxbox.x = x; 00292 if (y < minbox.y) minbox.y = y; if (y > maxbox.y) maxbox.y = y; 00293 } 00294 00296 void AddBoundingVertex (const csVector2& v) 00297 { 00298 AddBoundingVertex (v.x, v.y); 00299 } 00300 00306 void AddBoundingVertexSmart (float x, float y) 00307 { 00308 if (x < minbox.x) minbox.x = x; else if (x > maxbox.x) maxbox.x = x; 00309 if (y < minbox.y) minbox.y = y; else if (y > maxbox.y) maxbox.y = y; 00310 } 00311 00317 void AddBoundingVertexSmart (const csVector2& v) 00318 { 00319 AddBoundingVertexSmart (v.x, v.y); 00320 } 00321 00326 bool AddBoundingVertexTest (float x, float y) 00327 { 00328 bool rc = false; 00329 if (x < minbox.x) { minbox.x = x; rc = true; } 00330 if (x > maxbox.x) { maxbox.x = x; rc = true; } 00331 if (y < minbox.y) { minbox.y = y; rc = true; } 00332 if (y > maxbox.y) { maxbox.y = y; rc = true; } 00333 return rc; 00334 } 00335 00340 bool AddBoundingVertexTest (const csVector2& v) 00341 { 00342 return AddBoundingVertexTest (v.x, v.y); 00343 } 00344 00351 bool AddBoundingVertexSmartTest (float x, float y) 00352 { 00353 bool rc = false; 00354 if (x < minbox.x) { minbox.x = x; rc = true; } 00355 else if (x > maxbox.x) { maxbox.x = x; rc = true; } 00356 if (y < minbox.y) { minbox.y = y; rc = true; } 00357 else if (y > maxbox.y) { maxbox.y = y; rc = true; } 00358 return rc; 00359 } 00360 00367 bool AddBoundingVertexSmartTest (const csVector2& v) 00368 { 00369 return AddBoundingVertexSmartTest (v.x, v.y); 00370 } 00371 00373 csBox2 () : minbox (CS_BOUNDINGBOX_MAXVALUE, CS_BOUNDINGBOX_MAXVALUE), 00374 maxbox (-CS_BOUNDINGBOX_MAXVALUE, -CS_BOUNDINGBOX_MAXVALUE) {} 00375 00377 csBox2 (const csVector2& v) : minbox (v.x, v.y), maxbox (v.x, v.y) {} 00378 00380 csBox2 (float x1, float y1, float x2, float y2) : 00381 minbox (x1, y1), maxbox (x2, y2) 00382 { if (Empty ()) StartBoundingBox (); } 00383 00385 csBox2 (const csRect& r) : minbox (r.xmin, r.ymin), maxbox (r.xmax, r.ymax) 00386 { } 00387 00389 void Set (const csVector2& bmin, const csVector2& bmax) 00390 { 00391 minbox = bmin; 00392 maxbox = bmax; 00393 } 00394 00396 void Set (float x1, float y1, float x2, float y2) 00397 { 00398 if (x1>x2 || y1>y2) StartBoundingBox(); 00399 else { minbox.x = x1; minbox.y = y1; maxbox.x = x2; maxbox.y = y2; } 00400 } 00401 00403 void SetMin (int idx, float val) 00404 { 00405 if (idx == 1) minbox.y = val; 00406 else minbox.x = val; 00407 } 00408 00410 void SetMax (int idx, float val) 00411 { 00412 if (idx == 1) maxbox.y = val; 00413 else maxbox.x = val; 00414 } 00415 00420 csString Description() const; 00421 00423 csBox2& operator+= (const csBox2& box); 00425 csBox2& operator+= (const csVector2& point); 00427 csBox2& operator*= (const csBox2& box); 00429 bool TestIntersect (const csBox2& box) const; 00430 00432 friend CS_CSGEOM_EXPORT csBox2 operator+ (const csBox2& box1, 00433 const csBox2& box2); 00435 friend CS_CSGEOM_EXPORT csBox2 operator+ (const csBox2& box, 00436 const csVector2& point); 00438 friend CS_CSGEOM_EXPORT csBox2 operator* (const csBox2& box1, 00439 const csBox2& box2); 00440 00442 friend CS_CSGEOM_EXPORT bool operator== (const csBox2& box1, 00443 const csBox2& box2); 00445 friend CS_CSGEOM_EXPORT bool operator!= (const csBox2& box1, 00446 const csBox2& box2); 00448 friend CS_CSGEOM_EXPORT bool operator< (const csBox2& box1, 00449 const csBox2& box2); 00451 friend CS_CSGEOM_EXPORT bool operator> (const csBox2& box1, 00452 const csBox2& box2); 00454 friend CS_CSGEOM_EXPORT bool operator< (const csVector2& point, 00455 const csBox2& box); 00456 }; 00457 00462 00463 #define CS_BOX_CORNER_xyz 0 00464 00465 #define CS_BOX_CORNER_xyZ 1 00466 00467 #define CS_BOX_CORNER_xYz 2 00468 00469 #define CS_BOX_CORNER_xYZ 3 00470 00471 #define CS_BOX_CORNER_Xyz 4 00472 00473 #define CS_BOX_CORNER_XyZ 5 00474 00475 #define CS_BOX_CORNER_XYz 6 00476 00477 #define CS_BOX_CORNER_XYZ 7 00478 00479 #define CS_BOX_CENTER3 8 00480 00486 00487 #define CS_BOX_SIDE_x 0 00488 00489 #define CS_BOX_SIDE_X 1 00490 00491 #define CS_BOX_SIDE_y 2 00492 00493 #define CS_BOX_SIDE_Y 3 00494 00495 #define CS_BOX_SIDE_z 4 00496 00497 #define CS_BOX_SIDE_Z 5 00498 00499 #define CS_BOX_INSIDE 6 00500 00506 00507 #define CS_BOX_EDGE_Xyz_xyz 0 00508 00509 #define CS_BOX_EDGE_xyz_Xyz 1 00510 00511 #define CS_BOX_EDGE_xyz_xYz 2 00512 00513 #define CS_BOX_EDGE_xYz_xyz 3 00514 00515 #define CS_BOX_EDGE_xYz_XYz 4 00516 00517 #define CS_BOX_EDGE_XYz_xYz 5 00518 00519 #define CS_BOX_EDGE_XYz_Xyz 6 00520 00521 #define CS_BOX_EDGE_Xyz_XYz 7 00522 00523 #define CS_BOX_EDGE_Xyz_XyZ 8 00524 00525 #define CS_BOX_EDGE_XyZ_Xyz 9 00526 00527 #define CS_BOX_EDGE_XyZ_XYZ 10 00528 00529 #define CS_BOX_EDGE_XYZ_XyZ 11 00530 00531 #define CS_BOX_EDGE_XYZ_XYz 12 00532 00533 #define CS_BOX_EDGE_XYz_XYZ 13 00534 00535 #define CS_BOX_EDGE_XYZ_xYZ 14 00536 00537 #define CS_BOX_EDGE_xYZ_XYZ 15 00538 00539 #define CS_BOX_EDGE_xYZ_xYz 16 00540 00541 #define CS_BOX_EDGE_xYz_xYZ 17 00542 00543 #define CS_BOX_EDGE_xYZ_xyZ 18 00544 00545 #define CS_BOX_EDGE_xyZ_xYZ 19 00546 00547 #define CS_BOX_EDGE_xyZ_xyz 20 00548 00549 #define CS_BOX_EDGE_xyz_xyZ 21 00550 00551 #define CS_BOX_EDGE_xyZ_XyZ 22 00552 00553 #define CS_BOX_EDGE_XyZ_xyZ 23 00554 00563 class CS_CSGEOM_EXPORT csBox3 00564 { 00565 protected: 00567 csVector3 minbox; 00569 csVector3 maxbox; 00573 struct bEdge 00574 { 00575 uint8 v1, v2; // Indices of vertex in bounding box (CS_BOX_CORNER_...) 00576 uint8 fl, fr; // Indices of left/right faces sharing edge (CS_BOX_SIDE_...) 00577 }; 00579 typedef uint8 bFace[4]; 00584 static bEdge edges[24]; 00586 static bFace faces[6]; 00587 public: 00589 float MinX () const { return minbox.x; } 00591 float MinY () const { return minbox.y; } 00593 float MinZ () const { return minbox.z; } 00595 float MaxX () const { return maxbox.x; } 00597 float MaxY () const { return maxbox.y; } 00599 float MaxZ () const { return maxbox.z; } 00601 float Min (int idx) const 00602 { return idx == 1 ? minbox.y : idx == 0 ? minbox.x : minbox.z; } 00604 float Max (int idx) const 00605 { return idx == 1 ? maxbox.y : idx == 0 ? maxbox.x : maxbox.z; } 00607 const csVector3& Min () const { return minbox; } 00609 const csVector3& Max () const { return maxbox; } 00610 00620 csVector3 GetCorner (int corner) const; 00621 00627 void GetEdgeInfo (int edge, int& v1, int& v2, int& fleft, int& fright) const 00628 { 00629 v1 = edges[edge].v1; 00630 v2 = edges[edge].v2; 00631 fleft = edges[edge].fl; 00632 fright = edges[edge].fr; 00633 } 00634 00639 uint8* GetFaceEdges (int face) const 00640 { 00641 return faces[face]; 00642 } 00643 00647 csVector3 GetCenter () const { return (minbox+maxbox)/2; } 00648 00653 void SetCenter (const csVector3& c); 00654 00658 void SetSize (const csVector3& s); 00659 00664 csBox2 GetSide (int side) const; 00665 00670 void GetAxisPlane (int side, int& axis, float& where) const; 00671 00678 int GetVisibleSides (const csVector3& pos, int* visible_sides) const; 00679 00684 static int OtherSide (int side) 00685 { 00686 return side ^ 1; 00687 } 00688 00694 csSegment3 GetEdge (int edge) const 00695 { 00696 return csSegment3 (GetCorner (edges[edge].v1), GetCorner (edges[edge].v2)); 00697 } 00698 00704 void GetEdge (int edge, csSegment3& e) const 00705 { 00706 e.SetStart (GetCorner (edges[edge].v1)); 00707 e.SetEnd (GetCorner (edges[edge].v2)); 00708 } 00709 00711 bool In (float x, float y, float z) const 00712 { 00713 if (x < minbox.x || x > maxbox.x) return false; 00714 if (y < minbox.y || y > maxbox.y) return false; 00715 if (z < minbox.z || z > maxbox.z) return false; 00716 return true; 00717 } 00718 00720 bool In (const csVector3& v) const 00721 { 00722 return In (v.x, v.y, v.z); 00723 } 00724 00726 bool Overlap (const csBox3& box) const 00727 { 00728 if (maxbox.x < box.minbox.x || minbox.x > box.maxbox.x) return false; 00729 if (maxbox.y < box.minbox.y || minbox.y > box.maxbox.y) return false; 00730 if (maxbox.z < box.minbox.z || minbox.z > box.maxbox.z) return false; 00731 return true; 00732 } 00733 00735 bool Contains (const csBox3& box) const 00736 { 00737 return (box.minbox.x >= minbox.x && box.maxbox.x <= maxbox.x) && 00738 (box.minbox.y >= minbox.y && box.maxbox.y <= maxbox.y) && 00739 (box.minbox.z >= minbox.z && box.maxbox.z <= maxbox.z); 00740 } 00741 00743 bool Empty () const 00744 { 00745 if (minbox.x > maxbox.x) return true; 00746 if (minbox.y > maxbox.y) return true; 00747 if (minbox.z > maxbox.z) return true; 00748 return false; 00749 } 00750 00752 void StartBoundingBox () 00753 { 00754 minbox.x = CS_BOUNDINGBOX_MAXVALUE; 00755 minbox.y = CS_BOUNDINGBOX_MAXVALUE; 00756 minbox.z = CS_BOUNDINGBOX_MAXVALUE; 00757 maxbox.x = -CS_BOUNDINGBOX_MAXVALUE; 00758 maxbox.y = -CS_BOUNDINGBOX_MAXVALUE; 00759 maxbox.z = -CS_BOUNDINGBOX_MAXVALUE; 00760 } 00761 00763 void StartBoundingBox (const csVector3& v) 00764 { 00765 minbox = v; maxbox = v; 00766 } 00767 00769 void AddBoundingVertex (float x, float y, float z) 00770 { 00771 if (x < minbox.x) minbox.x = x; if (x > maxbox.x) maxbox.x = x; 00772 if (y < minbox.y) minbox.y = y; if (y > maxbox.y) maxbox.y = y; 00773 if (z < minbox.z) minbox.z = z; if (z > maxbox.z) maxbox.z = z; 00774 } 00775 00777 void AddBoundingVertex (const csVector3& v) 00778 { 00779 AddBoundingVertex (v.x, v.y, v.z); 00780 } 00781 00787 void AddBoundingVertexSmart (float x, float y, float z) 00788 { 00789 if (x < minbox.x) minbox.x = x; else if (x > maxbox.x) maxbox.x = x; 00790 if (y < minbox.y) minbox.y = y; else if (y > maxbox.y) maxbox.y = y; 00791 if (z < minbox.z) minbox.z = z; else if (z > maxbox.z) maxbox.z = z; 00792 } 00793 00799 void AddBoundingVertexSmart (const csVector3& v) 00800 { 00801 AddBoundingVertexSmart (v.x, v.y, v.z); 00802 } 00803 00808 bool AddBoundingVertexTest (float x, float y, float z) 00809 { 00810 bool rc = false; 00811 if (x < minbox.x) { minbox.x = x; rc = true; } 00812 if (x > maxbox.x) { maxbox.x = x; rc = true; } 00813 if (y < minbox.y) { minbox.y = y; rc = true; } 00814 if (y > maxbox.y) { maxbox.y = y; rc = true; } 00815 if (z < minbox.z) { minbox.z = z; rc = true; } 00816 if (z > maxbox.z) { maxbox.z = z; rc = true; } 00817 return rc; 00818 } 00819 00824 bool AddBoundingVertexTest (const csVector3& v) 00825 { 00826 return AddBoundingVertexTest (v.x, v.y, v.z); 00827 } 00828 00835 bool AddBoundingVertexSmartTest (float x, float y, float z) 00836 { 00837 bool rc = false; 00838 if (x < minbox.x) { minbox.x = x; rc = true; } 00839 else if (x > maxbox.x) { maxbox.x = x; rc = true; } 00840 if (y < minbox.y) { minbox.y = y; rc = true; } 00841 else if (y > maxbox.y) { maxbox.y = y; rc = true; } 00842 if (z < minbox.z) { minbox.z = z; rc = true; } 00843 else if (z > maxbox.z) { maxbox.z = z; rc = true; } 00844 return rc; 00845 } 00846 00853 bool AddBoundingVertexSmartTest (const csVector3& v) 00854 { 00855 return AddBoundingVertexSmartTest (v.x, v.y, v.z); 00856 } 00857 00859 csBox3 () : 00860 minbox ( CS_BOUNDINGBOX_MAXVALUE, 00861 CS_BOUNDINGBOX_MAXVALUE, 00862 CS_BOUNDINGBOX_MAXVALUE), 00863 maxbox (-CS_BOUNDINGBOX_MAXVALUE, 00864 -CS_BOUNDINGBOX_MAXVALUE, 00865 -CS_BOUNDINGBOX_MAXVALUE) {} 00866 00868 csBox3 (const csVector3& v) : minbox (v), maxbox (v) { } 00869 00871 csBox3 (const csVector3& v1, const csVector3& v2) : 00872 minbox (v1), maxbox (v2) 00873 { if (Empty ()) StartBoundingBox (); } 00874 00876 csBox3 (float x1, float y1, float z1, float x2, float y2, float z2) : 00877 minbox (x1, y1, z1), maxbox (x2, y2, z2) 00878 { if (Empty ()) StartBoundingBox (); } 00879 00881 void Set (const csVector3& bmin, const csVector3& bmax) 00882 { 00883 minbox = bmin; 00884 maxbox = bmax; 00885 } 00886 00888 void Set (float x1, float y1, float z1, float x2, float y2, float z2) 00889 { 00890 if (x1>x2 || y1>y2 || z1>z2) StartBoundingBox(); 00891 else 00892 { 00893 minbox.x = x1; minbox.y = y1; minbox.z = z1; 00894 maxbox.x = x2; maxbox.y = y2; maxbox.z = z2; 00895 } 00896 } 00897 00899 void SetMin (int idx, float val) 00900 { 00901 if (idx == 1) minbox.y = val; 00902 else if (idx == 0) minbox.x = val; 00903 else minbox.z = val; 00904 } 00905 00907 void SetMax (int idx, float val) 00908 { 00909 if (idx == 1) maxbox.y = val; 00910 else if (idx == 0) maxbox.x = val; 00911 else maxbox.z = val; 00912 } 00913 00918 csString Description() const; 00919 00923 void Split (int axis, float where, csBox3& bl, csBox3& br) const 00924 { 00925 switch (axis) 00926 { 00927 case CS_AXIS_X: 00928 bl.Set (minbox.x, minbox.y, minbox.z, 00929 where, maxbox.y, maxbox.z); 00930 br.Set (where, minbox.y, minbox.z, 00931 maxbox.x, maxbox.y, maxbox.z); 00932 break; 00933 case CS_AXIS_Y: 00934 bl.Set (minbox.x, minbox.y, minbox.z, 00935 maxbox.x, where, maxbox.z); 00936 br.Set (minbox.x, where, minbox.z, 00937 maxbox.x, maxbox.y, maxbox.z); 00938 break; 00939 case CS_AXIS_Z: 00940 bl.Set (minbox.x, minbox.y, minbox.z, 00941 maxbox.x, maxbox.y, where); 00942 br.Set (minbox.x, minbox.y, where, 00943 maxbox.x, maxbox.y, maxbox.z); 00944 break; 00945 } 00946 } 00947 00954 int TestSplit (int axis, float where) const 00955 { 00956 if (maxbox[axis] < where) return -1; 00957 if (minbox[axis] > where) return 1; 00958 return 0; 00959 } 00960 00964 bool AdjacentX (const csBox3& other, float epsilon = SMALL_EPSILON) const; 00965 00969 bool AdjacentY (const csBox3& other, float epsilon = SMALL_EPSILON) const; 00970 00974 bool AdjacentZ (const csBox3& other, float epsilon = SMALL_EPSILON) const; 00975 00983 int Adjacent (const csBox3& other, float epsilon = SMALL_EPSILON) const; 00984 00991 int CalculatePointSegment (const csVector3& pos) const; 00992 01001 void GetConvexOutline (const csVector3& pos, 01002 csVector3* array, int& num_array, bool bVisible=false) const; 01003 01007 bool Between (const csBox3& box1, const csBox3& box2) const; 01008 01013 void ManhattanDistance (const csBox3& other, csVector3& dist) const; 01014 01019 float SquaredOriginDist () const; 01020 01026 float SquaredOriginMaxDist () const; 01027 01039 bool ProjectBox (const csTransform& trans, float fov, float sx, float sy, 01040 csBox2& sbox, float& min_z, float& max_z) const; 01041 01051 bool ProjectOutline (const csTransform& trans, float fov, float sx, float sy, 01052 csPoly2D& poly, float& min_z, float& max_z) const; 01053 01061 bool ProjectOutline (const csVector3& origin, 01062 int axis, float where, csArray<csVector2>& poly) const; 01063 01069 bool ProjectOutline (const csVector3& origin, 01070 int axis, float where, csPoly2D& poly) const; 01071 01084 bool ProjectBoxAndOutline (const csTransform& trans, float fov, 01085 float sx, float sy, csBox2& sbox, csPoly2D& poly, 01086 float& min_z, float& max_z) const; 01087 01089 csBox3& operator+= (const csBox3& box); 01091 csBox3& operator+= (const csVector3& point); 01093 csBox3& operator*= (const csBox3& box); 01095 bool TestIntersect (const csBox3& box) const; 01096 01098 friend CS_CSGEOM_EXPORT csBox3 operator+ (const csBox3& box1, 01099 const csBox3& box2); 01101 friend CS_CSGEOM_EXPORT csBox3 operator+ (const csBox3& box, 01102 const csVector3& point); 01104 friend CS_CSGEOM_EXPORT csBox3 operator* (const csBox3& box1, 01105 const csBox3& box2); 01106 01108 friend CS_CSGEOM_EXPORT bool operator== (const csBox3& box1, 01109 const csBox3& box2); 01111 friend CS_CSGEOM_EXPORT bool operator!= (const csBox3& box1, 01112 const csBox3& box2); 01114 friend CS_CSGEOM_EXPORT bool operator< (const csBox3& box1, 01115 const csBox3& box2); 01117 friend CS_CSGEOM_EXPORT bool operator> (const csBox3& box1, 01118 const csBox3& box2); 01120 friend CS_CSGEOM_EXPORT bool operator< (const csVector3& point, 01121 const csBox3& box); 01122 }; 01123 01126 #endif // __CS_BOX_H__
Generated for Crystal Space by doxygen 1.3.9.1