1 2 /*************************************************************************\ 3 4 Copyright 1995 The University of North Carolina at Chapel Hill. 5 All Rights Reserved. 6 7 Permission to use, copy, modify and distribute this software and its 8 documentation for educational, research and non-profit purposes, without 9 fee, and without a written agreement is hereby granted, provided that the 10 above copyright notice and the following three paragraphs appear in all 11 copies. 12 13 IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE 14 LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR 15 CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE 16 USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY 17 OF NORTH CAROLINA HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH 18 DAMAGES. 19 20 21 Permission to use, copy, modify and distribute this software and its 22 documentation for educational, research and non-profit purposes, without 23 fee, and without a written agreement is hereby granted, provided that the 24 above copyright notice and the following three paragraphs appear in all 25 copies. 26 27 THE UNIVERSITY OF NORTH CAROLINA SPECIFICALLY DISCLAIM ANY 28 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 29 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 30 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 31 NORTH CAROLINA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, 32 UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 33 34 The authors may be contacted via: 35 36 US Mail: S. Gottschalk 37 Department of Computer Science 38 Sitterson Hall, CB #3175 39 University of N. Carolina 40 Chapel Hill, NC 27599-3175 41 42 Phone: (919)962-1749 43 44 EMail: {gottscha}@cs.unc.edu 45 46 47 \**************************************************************************/ 48 49 #ifndef OBB_H 50 #define OBB_H 51 52 struct tri 53 { 54 int id; 55 double p1[3], p2[3], p3[3]; 56 }; 57 58 59 class box 60 { 61 public: 62 63 // placement in parent's space 64 // box to parent space: x_m = pR*x_b + pT 65 // parent to box space: x_b = pR.T()*(x_m - pT) 66 double pR[3][3]; 67 double pT[3]; 68 69 // dimensions 70 double d[3]; // this is "radius", that is, 71 // half the measure of a side length 72 73 box *P; // points to but does not "own". 74 box *N; 75 76 tri *trp; 77 leaf()78 int leaf() { return (!P && !N); } size()79 double size() { return d[0]; } 80 81 int split_recurse(int *t, int n); 82 int split_recurse(int *t); // specialized for leaf nodes 83 }; 84 85 const int RAPID_BUILD_STATE_CONST = 0; // "empty" state, after constructor 86 const int RAPID_BUILD_STATE_BEGIN = 1; // after BeginModel() 87 const int RAPID_BUILD_STATE_ADDTRI = 2; // after AddTri() 88 const int RAPID_BUILD_STATE_PROCESSED = 3; // after EndModel() 89 90 #endif 91