src/scene.cc
branchpyrit
changeset 7 bf17f9f84c91
parent 0 3547b885df7e
child 8 e6567b740c5e
equal deleted inserted replaced
6:d8d596d26f25 7:bf17f9f84c91
   163 		return false;
   163 		return false;
   164 
   164 
   165 	dist = t;
   165 	dist = t;
   166 	return true;
   166 	return true;
   167 }
   167 }
       
   168 
       
   169 BBox Triangle::get_bbox()
       
   170 {
       
   171 	BBox bbox = BBox();
       
   172 	bbox.L = A;
       
   173 	if (B.x < bbox.L.x)  bbox.L.x = B.x;
       
   174 	if (C.x < bbox.L.x)  bbox.L.x = C.x;
       
   175 	if (B.y < bbox.L.y)  bbox.L.y = B.y;
       
   176 	if (C.y < bbox.L.y)  bbox.L.y = C.y;
       
   177 	if (B.z < bbox.L.z)  bbox.L.z = B.z;
       
   178 	if (C.z < bbox.L.z)  bbox.L.z = C.z;
       
   179 	bbox.R = A;
       
   180 	if (B.x > bbox.R.x)  bbox.R.x = B.x;
       
   181 	if (C.x > bbox.R.x)  bbox.R.x = C.x;
       
   182 	if (B.y > bbox.R.y)  bbox.R.y = B.y;
       
   183 	if (C.y > bbox.R.y)  bbox.R.y = C.y;
       
   184 	if (B.z > bbox.R.z)  bbox.R.z = B.z;
       
   185 	if (C.z > bbox.R.z)  bbox.R.z = C.z;
       
   186 	return bbox;
       
   187 };