summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/BoundBoxTemp.java
blob: 0b69c9b070087b85908a25c65bec493bd7035749 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*     */ package NET.worlds.scape;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class BoundBoxTemp
/*     */ {
/*  25 */   private static Recycler recycler = new Recycler();
/*     */   
/*     */   public Point3Temp lo;
/*     */   
/*     */   public Point3Temp hi;
/*     */   
/*     */   public static BoundBoxTemp make(Point3Temp a, Point3Temp b)
/*     */   {
/*  33 */     BoundBoxTemp t = (BoundBoxTemp)recycler.alloc();
/*     */     
/*  35 */     if (t == null)
/*     */     {
/*  37 */       recycler.recycle(new BoundBoxTemp());
/*  38 */       t = (BoundBoxTemp)recycler.alloc();
/*     */     }
/*     */     
/*  41 */     t.lo = Point3Temp.make(a);
/*  42 */     t.hi = Point3Temp.make(b);
/*     */     
/*  44 */     if (a.x > b.x)
/*     */     {
/*  46 */       t.lo.x = b.x;
/*  47 */       t.hi.x = a.x;
/*     */     }
/*     */     
/*  50 */     if (a.y > b.y)
/*     */     {
/*  52 */       t.lo.y = b.y;
/*  53 */       t.hi.y = a.y;
/*     */     }
/*     */     
/*  56 */     if (a.z > b.z)
/*     */     {
/*  58 */       t.lo.z = b.z;
/*  59 */       t.hi.z = a.z;
/*     */     }
/*  61 */     return t;
/*     */   }
/*     */   
/*     */   public static BoundBoxTemp make(BoundBoxTemp b)
/*     */   {
/*  66 */     return make(b.lo, b.hi);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public boolean contains(Point3Temp p)
/*     */   {
/*  78 */     return (p.x >= this.lo.x) && (p.x <= this.hi.x) && 
/*  79 */       (p.y >= this.lo.y) && (p.y <= this.hi.y) && 
/*  80 */       (p.z >= this.lo.z) && (p.z <= this.hi.z);
/*     */   }
/*     */   
/*     */   public boolean isEmpty()
/*     */   {
/*  85 */     return (this.lo.x == this.hi.x) && (this.lo.y == this.hi.y) && (this.lo.z == this.hi.z);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public boolean overlaps(BoundBoxTemp r)
/*     */   {
/*  93 */     return (this.hi.x >= r.lo.x) && (r.hi.x >= this.lo.x) && 
/*  94 */       (this.hi.y >= r.lo.y) && (r.hi.y >= this.lo.y) && 
/*  95 */       (this.hi.z >= r.lo.z) && (r.hi.z >= this.lo.z);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public void encompass(Point3Temp p)
/*     */   {
/* 103 */     if (p.x < this.lo.x)
/* 104 */       this.lo.x = p.x;
/* 105 */     if (p.y < this.lo.y)
/* 106 */       this.lo.y = p.y;
/* 107 */     if (p.z < this.lo.z)
/* 108 */       this.lo.z = p.z;
/* 109 */     if (p.x > this.hi.x)
/* 110 */       this.hi.x = p.x;
/* 111 */     if (p.y > this.hi.y)
/* 112 */       this.hi.y = p.y;
/* 113 */     if (p.z > this.hi.z) {
/* 114 */       this.hi.z = p.z;
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public String toString()
/*     */   {
/* 122 */     return "BoundBoxTemp[lo=" + this.lo + ", hi=" + this.hi + "]";
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\BoundBoxTemp.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */