AnimatLab  2
Test
BoundingBox.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 #include "BoundingBox.h"
9 
10 namespace AnimatSim
11 {
12 
20 {
21 }
22 
30 {
31 }
32 
33 
34 void BoundingBox::Set(CStdFPoint &vMin, CStdFPoint &vMax)
35 {
36  Min = vMin;
37  Max = vMax;
38 }
39 
40 void BoundingBox::Set(float MinX, float MinY, float MinZ, float MaxX, float MaxY, float MaxZ)
41 {
42  Min.Set(MinX, MinY, MinZ);
43  Max.Set(MaxX, MaxY, MaxZ);
44 }
45 
47 {
48  return Max.x - Min.x;
49 }
50 
52 {
53  return Max.z - Min.z;
54 }
55 
57 {
58  return Max.y - Min.y;
59 }
60 
62 {
63  if(iAxis == 0)
64  return Length();
65  else if(iAxis == 1)
66  return Height();
67  else if(iAxis == 2)
68  return Width();
69  else
70  return -1;
71 }
72 
74 {
75  float fltMax = -1;
76 
77  fltMax = STD_MAX(fabs(Min.x), fabs(Min.y));
78  fltMax = STD_MAX((double) fltMax, fabs(Min.z));
79 
80  fltMax = STD_MAX((double) fltMax, fabs(Max.x));
81  fltMax = STD_MAX((double) fltMax, fabs(Max.y));
82  fltMax = STD_MAX((double) fltMax, fabs(Max.z));
83 
84  return fltMax;
85 }
86 
87 
89 {
90  Min=oBox.Min;
91  Max=oBox.Max;
92 }
93 
94 }//end namespace AnimatSim
Root namespace for the base simulation library for AnimatLab.
CStdFPoint Min
A vertex with the minimum widths of the bounding box.
Definition: BoundingBox.h:21
float Width()
Gets the width = (Max.z - Min.z).
Definition: BoundingBox.cpp:51
BoundingBox(void)
Default constructor.
Definition: BoundingBox.cpp:19
float Length()
Gets the length = (Max.x - Min.x).
Definition: BoundingBox.cpp:46
Declares the bounding box class.
void operator=(const BoundingBox &oBox)
Compares two bounding boxes to see if they are equal.
Definition: BoundingBox.cpp:88
Bounding box class for geometric objects.
Definition: BoundingBox.h:17
float Height()
Gets the height = (Max.y - Min.y).
Definition: BoundingBox.cpp:56
float MaxDimension()
Gets the maximum dimension.
Definition: BoundingBox.cpp:73
CStdFPoint Max
A vertex with the maximum widths of the bounding box.
Definition: BoundingBox.h:24
~BoundingBox(void)
Destructor.
Definition: BoundingBox.cpp:29
float GetDimensionSize(int iAxis)
Gets the size along the supplied dimension.
Definition: BoundingBox.cpp:61
void Set(CStdFPoint &vMin, CStdFPoint &vMax)
Sets the minimum and maximum widths of the bounding box.
Definition: BoundingBox.cpp:34