@@ -16,56 +16,56 @@ struct AABB {
1616 static constexpr int kDim = dim_v<PointT>;
1717 static constexpr int kNumCorners = int_math::exp2(kDim );
1818 using PointType = PointT;
19- using ScalarType = typename PointType ::Scalar;
19+ using ScalarType = typename PointT ::Scalar;
2020 using Corners = Eigen::Matrix<ScalarType, kDim , kNumCorners >;
2121
2222 static constexpr auto kInitialMin = std::numeric_limits<ScalarType>::max();
2323 static constexpr auto kInitialMax = std::numeric_limits<ScalarType>::lowest();
2424
25- PointType min = PointType ::Constant(kInitialMin );
26- PointType max = PointType ::Constant(kInitialMax );
25+ PointT min = PointT ::Constant(kInitialMin );
26+ PointT max = PointT ::Constant(kInitialMax );
2727
2828 AABB () = default;
2929 AABB (const PointT& min, const PointT& max) : min(min), max(max) {}
3030 AABB (PointT&& min, PointT&& max) : min(std::move(min)), max(std::move(max)) {}
3131
32- void insert (const PointType & point) {
32+ void insert (const PointT & point) {
3333 min = min.cwiseMin (point);
3434 max = max.cwiseMax (point);
3535 }
36- bool contains (const PointType & point) const {
36+ bool contains (const PointT & point) const {
3737 return (min.array () <= point.array () && point.array () <= max.array ()).all ();
3838 }
3939
40- PointType closestPointTo (const PointType & point) const {
41- PointType closest_point = point.cwiseMax (min).cwiseMin (max);
40+ PointT closestPointTo (const PointT & point) const {
41+ PointT closest_point = point.cwiseMax (min).cwiseMin (max);
4242 return closest_point;
4343 }
44- PointType furthestPointFrom (const PointType & point) const {
45- const PointType aabb_center = (min + max) / static_cast <ScalarType>(2 );
46- PointType furthest_point =
44+ PointT furthestPointFrom (const PointT & point) const {
45+ const PointT aabb_center = (min + max) / static_cast <ScalarType>(2 );
46+ PointT furthest_point =
4747 (aabb_center.array () < point.array ()).select (min, max);
4848 return furthest_point;
4949 }
5050
51- PointType minOffsetTo (const PointType & point) const {
51+ PointT minOffsetTo (const PointT & point) const {
5252 return point - closestPointTo (point);
5353 }
54- PointType maxOffsetTo (const PointType & point) const {
54+ PointT maxOffsetTo (const PointT & point) const {
5555 return point - furthestPointFrom (point);
5656 }
5757 // TODO(victorr): Check correctness with unit tests
58- PointType minOffsetTo (const AABB& other) const {
59- const PointType greatest_min = min.cwiseMax (other.min );
60- const PointType smallest_max = max.cwiseMin (other.max );
58+ PointT minOffsetTo (const AABB& other) const {
59+ const PointT greatest_min = min.cwiseMax (other.min );
60+ const PointT smallest_max = max.cwiseMin (other.max );
6161 return (greatest_min - smallest_max).cwiseMax (0 );
6262 }
6363 // TODO(victorr): Check correctness with unit tests. Pay particular
6464 // attention to whether the offset signs are correct.
65- PointType maxOffsetTo (const AABB& other) const {
66- const PointType diff_1 = min - other.max ;
67- const PointType diff_2 = max - other.min ;
68- PointType offset =
65+ PointT maxOffsetTo (const AABB& other) const {
66+ const PointT diff_1 = min - other.max ;
67+ const PointT diff_2 = max - other.min ;
68+ PointT offset =
6969 (diff_2.array ().abs () < diff_1.array ().abs ()).select (diff_1, diff_2);
7070 return offset;
7171 }
@@ -92,7 +92,7 @@ struct AABB {
9292 ScalarType width () const {
9393 return max[dim] - min[dim];
9494 }
95- PointType widths () const { return max - min; }
95+ PointT widths () const { return max - min; }
9696
9797 Corners corner_matrix () const {
9898 Eigen::Matrix<ScalarType, kDim , kNumCorners > corners;
@@ -104,8 +104,8 @@ struct AABB {
104104 return corners;
105105 }
106106
107- PointType corner_point (int corner_idx) const {
108- PointType corner;
107+ PointT corner_point (int corner_idx) const {
108+ PointT corner;
109109 for (int dim_idx = 0 ; dim_idx < kDim ; ++dim_idx) {
110110 corner[dim_idx] = corner_coordinate (dim_idx, corner_idx);
111111 }
0 commit comments