opennurbs_box.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #if !defined(ON_BOX_INC_)
18 #define ON_BOX_INC_
19 
20 class ON_CLASS ON_Box
21 {
22 public:
24  // intervals are finite and increasing when the box is valid
28 
29  ON_Box();
30  ON_Box( const ON_BoundingBox& bbox );
31  ~ON_Box();
32 
33  bool IsValid() const;
34 
35  bool Create( const ON_BoundingBox& bbox );
36 
37  void Destroy();
38 
39  ON_3dPoint Center() const;
40  bool GetCorners( ON_3dPoint* corners ) const;
41  bool GetCorners( ON_SimpleArray<ON_3dPoint>& corners ) const;
42 
43  ON_BoundingBox BoundingBox() const;
44 
45  ON_3dPoint PointAt(
46  double r,
47  double s,
48  double t
49  ) const;
50 
51  bool ClosestPointTo(
52  ON_3dPoint point,
53  double* r,
54  double* s,
55  double* t
56  ) const;
57 
58  // returns point on box that is closest to given point
59  ON_3dPoint ClosestPointTo(
60  ON_3dPoint test_point
61  ) const;
62 
63  // rotate sphere about its origin
64  bool Rotate(
65  double sin_angle, // sin(angle)
66  double cos_angle, // cos(angle)
67  const ON_3dVector& axis_of_rotation // axis of rotation
68  );
69 
70  bool Rotate(
71  double angle_radians, // angle in radians
72  const ON_3dVector& axis_of_rotation // axis of rotation
73  );
74 
75  // rotate sphere about a point and axis
76  bool Rotate(
77  double sin_angle, // sin(angle)
78  double cos_angle, // cos(angle)
79  const ON_3dVector& axis_of_rotation, // axis of rotation
80  const ON_3dPoint& center_of_rotation // center of rotation
81  );
82 
83  bool Rotate(
84  double angle_radians, // angle in radians
85  const ON_3dVector& axis_of_rotation, // axis of rotation
86  const ON_3dPoint& center_of_rotation // center of rotation
87  );
88 
89  bool Translate(
90  const ON_3dVector&
91  );
92 
93  bool Transform( const ON_Xform& );
94 
95  /*
96  Description:
97  Test the box to see if it is degenerate (flat)
98  in one or more directions.
99  Parameters:
100  tolerance - [in] Distances <= tolerance will be considered
101  to be zero. If tolerance is negative (default), then
102  a scale invarient tolerance is used.
103  Returns:
104  @untitled table
105  0 box is not degenerate
106  1 box is a rectangle (degenerate in one direction)
107  2 box is a line (degenerate in two directions)
108  3 box is a point (degenerate in three directions)
109  4 box is not valid
110  */
111  int IsDegenerate(
112  double tolerance = ON_UNSET_VALUE
113  ) const;
114 
115  double Volume() const;
116 
117  double Area() const;
118 };
119 
120 #endif
ON_Interval dx
intervals are finite and increasing when the box is valid
Definition: opennurbs_box.h:25
ON_Interval dy
Definition: opennurbs_box.h:26
ON_Interval dz
Definition: opennurbs_box.h:27
Definition: opennurbs_box.h:20
Definition: opennurbs_bounding_box.h:25
Definition: opennurbs_xform.h:28
Definition: opennurbs_point.h:460
ON_Plane plane
Definition: opennurbs_box.h:23
Definition: opennurbs_plane.h:20
Definition: opennurbs_point.h:1152
Definition: opennurbs_point.h:46