OSDN Git Service

DTXMania089リリースに際してのtag付け。
[dtxmania/dtxmania.git] / 110401(DTXMania089) / SlimDXc_Jun2010(VC++2008) / source / math / BoundingBox.h
1 /*\r
2 * Copyright (c) 2007-2010 SlimDX Group\r
3\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy\r
5 * of this software and associated documentation files (the "Software"), to deal\r
6 * in the Software without restriction, including without limitation the rights\r
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
8 * copies of the Software, and to permit persons to whom the Software is\r
9 * furnished to do so, subject to the following conditions:\r
10\r
11 * The above copyright notice and this permission notice shall be included in\r
12 * all copies or substantial portions of the Software.\r
13\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
20 * THE SOFTWARE.\r
21 */\r
22 #pragma once\r
23 \r
24 #include "../design/BoundingBoxConverter.h"\r
25 \r
26 #include "Enums.h"\r
27 #include "Vector3.h"\r
28 \r
29 using System::Runtime::InteropServices::OutAttribute;\r
30 \r
31 namespace SlimDX\r
32 {\r
33         value class BoundingSphere;\r
34         value class Plane;\r
35         value class Ray;\r
36 \r
37         ref class DataStream;\r
38 \r
39         /// <summary>\r
40         /// An axis aligned bounding box, specified by minimum and maximum vectors.\r
41         /// </summary>\r
42         /// <unmanaged>None</unmanaged>\r
43         [System::Serializable]\r
44         [System::Runtime::InteropServices::StructLayout( System::Runtime::InteropServices::LayoutKind::Sequential )]\r
45         [System::ComponentModel::TypeConverter( SlimDX::Design::BoundingBoxConverter::typeid )]\r
46         public value class BoundingBox : System::IEquatable<BoundingBox>\r
47         {\r
48         public:\r
49                 /// <summary>\r
50                 /// The highest corner of the box.\r
51                 /// </summary>\r
52                 Vector3 Maximum;\r
53 \r
54                 /// <summary>\r
55                 /// The lowest corner of the box.\r
56                 /// </summary>\r
57                 Vector3 Minimum;\r
58 \r
59                 /// <summary>\r
60                 /// Initializes a new instance of the <see cref="BoundingBox"/> structure.\r
61                 /// </summary>\r
62                 /// <param name="minimum">The lowest corner of the box.</param>\r
63                 /// <param name="maximum">The highest corner of the box.</param>\r
64                 BoundingBox( Vector3 minimum, Vector3 maximum );\r
65 \r
66                 /// <summary>\r
67                 /// Retrieves the eight corners of the bounding box.\r
68                 /// </summary>\r
69                 /// <returns>An array of points representing the eight corners of the bounding box.</returns>\r
70                 array<Vector3>^ GetCorners();\r
71 \r
72                 /// <summary>\r
73                 /// Determines whether the box contains the specified box.\r
74                 /// </summary>\r
75                 /// <param name="box1">The first box that will be checked for containment.</param>\r
76                 /// <param name="box2">The second box that will be checked for containment.</param>\r
77                 /// <returns>A member of the <see cref="ContainmentType"/> enumeration indicating whether the two objects intersect, are contained, or don't meet at all.</returns>\r
78                 static ContainmentType Contains( BoundingBox box1, BoundingBox box2 );\r
79 \r
80                 /// <summary>\r
81                 /// Determines whether the box contains the specified sphere.\r
82                 /// </summary>\r
83                 /// <param name="box">The box that will be checked for containment.</param>\r
84                 /// <param name="sphere">The sphere that will be checked for containment.</param>\r
85                 /// <returns>A member of the <see cref="ContainmentType"/> enumeration indicating whether the two objects intersect, are contained, or don't meet at all.</returns>\r
86                 static ContainmentType Contains( BoundingBox box, BoundingSphere sphere );\r
87 \r
88                 /// <summary>\r
89                 /// Determines whether the box contains the specified point.\r
90                 /// </summary>\r
91                 /// <param name="box">The box that will be checked for containment.</param>\r
92                 /// <param name="vector">The point that will be checked for containment.</param>\r
93                 /// <returns>A member of the <see cref="ContainmentType"/> enumeration indicating whether the two objects intersect, are contained, or don't meet at all.</returns>\r
94                 static ContainmentType Contains( BoundingBox box, Vector3 vector );\r
95 \r
96                 /// <summary>\r
97                 /// Constructs a <see cref="BoundingBox"/> that fully contains the given points.\r
98                 /// </summary>\r
99                 /// <param name="points">The points that will be contained by the box.</param>\r
100                 /// <returns>The newly constructed bounding box.</returns>\r
101                 static BoundingBox FromPoints( array<Vector3>^ points );\r
102 \r
103                 /// <summary>\r
104                 /// Constructs a <see cref="BoundingBox"/> that fully contains the given points.\r
105                 /// </summary>\r
106                 /// <param name="points">The points that will be contained by the box.</param>\r
107                 /// <param name="count">The number of vertices in the stream.</param>\r
108                 /// <param name="stride">The number of bytes between vertices.</param>\r
109                 /// <returns>The newly constructed bounding box.</returns>\r
110                 static BoundingBox FromPoints( DataStream^ points, int count, int stride );\r
111 \r
112                 /// <summary>\r
113                 /// Constructs a <see cref="BoundingBox"/> from a given sphere.\r
114                 /// </summary>\r
115                 /// <param name="sphere">The sphere that will designate the extents of the box.</param>\r
116                 /// <returns>The newly constructed bounding box.</returns>\r
117                 static BoundingBox FromSphere( BoundingSphere sphere );\r
118 \r
119                 /// <summary>\r
120                 /// Constructs a <see cref="BoundingBox"/> that is the as large as the total combined area of the two specified boxes.\r
121                 /// </summary>\r
122                 /// <param name="box1">The first box to merge.</param>\r
123                 /// <param name="box2">The second box to merge.</param>\r
124                 /// <returns>The newly constructed bounding box.</returns>\r
125                 static BoundingBox Merge( BoundingBox box1, BoundingBox box2 );\r
126 \r
127                 /// <summary>\r
128                 /// Determines whether a box intersects the specified object.\r
129                 /// </summary>\r
130                 /// <param name="box1">The first box which will be tested for intersection.</param>\r
131                 /// <param name="box2">The second box that will be tested for intersection.</param>\r
132                 /// <returns><c>true</c> if the two objects are intersecting; otherwise, <c>false</c>.</returns>\r
133                 static bool Intersects( BoundingBox box1, BoundingBox box2 );\r
134 \r
135                 /// <summary>\r
136                 /// Determines whether a box intersects the specified object.\r
137                 /// </summary>\r
138                 /// <param name="box">The box which will be tested for intersection.</param>\r
139                 /// <param name="sphere">The sphere that will be tested for intersection.</param>\r
140                 /// <returns><c>true</c> if the two objects are intersecting; otherwise, <c>false</c>.</returns>\r
141                 static bool Intersects( BoundingBox box, BoundingSphere sphere );\r
142 \r
143                 /// <summary>\r
144                 /// Determines whether a box intersects the specified object.\r
145                 /// </summary>\r
146                 /// <param name="box">The box which will be tested for intersection.</param>\r
147                 /// <param name="ray">The ray that will be tested for intersection.</param>\r
148                 /// <param name="distance">When the method completes, contains the distance from the ray's origin in which the intersection with the box occured.</param>\r
149                 /// <returns><c>true</c> if the two objects are intersecting; otherwise, <c>false</c>.</returns>\r
150                 static bool Intersects( BoundingBox box, Ray ray, [Out] float% distance );\r
151 \r
152                 /// <summary>\r
153                 /// Finds the intersection between a plane and a box.\r
154                 /// </summary>\r
155                 /// <param name="box">The box to check for intersection.</param>\r
156                 /// <param name="plane">The source plane.</param>\r
157                 /// <returns>A value from the <see cref="PlaneIntersectionType"/> enumeration describing the result of the intersection test.</returns>\r
158                 static PlaneIntersectionType Intersects( BoundingBox box, Plane plane );\r
159 \r
160                 /// <summary>\r
161                 /// Tests for equality between two objects.\r
162                 /// </summary>\r
163                 /// <param name="left">The first value to compare.</param>\r
164                 /// <param name="right">The second value to compare.</param>\r
165                 /// <returns><c>true</c> if <paramref name="left"/> has the same value as <paramref name="right"/>; otherwise, <c>false</c>.</returns>\r
166                 static bool operator == ( BoundingBox left, BoundingBox right );\r
167 \r
168                 /// <summary>\r
169                 /// Tests for inequality between two objects.\r
170                 /// </summary>\r
171                 /// <param name="left">The first value to compare.</param>\r
172                 /// <param name="right">The second value to compare.</param>\r
173                 /// <returns><c>true</c> if <paramref name="left"/> has a different value than <paramref name="right"/>; otherwise, <c>false</c>.</returns>\r
174                 static bool operator != ( BoundingBox left, BoundingBox right );\r
175 \r
176                 /// <summary>\r
177                 /// Converts the value of the object to its equivalent string representation.\r
178                 /// </summary>\r
179                 /// <returns>The string representation of the value of this instance.</returns>\r
180                 virtual System::String^ ToString() override;\r
181 \r
182                 /// <summary>\r
183                 /// Returns the hash code for this instance.\r
184                 /// </summary>\r
185                 /// <returns>A 32-bit signed integer hash code.</returns>\r
186                 virtual int GetHashCode() override;\r
187 \r
188                 /// <summary>\r
189                 /// Returns a value that indicates whether the current instance is equal to a specified object. \r
190                 /// </summary>\r
191                 /// <param name="obj">Object to make the comparison with.</param>\r
192                 /// <returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>\r
193                 virtual bool Equals( System::Object^ obj ) override;\r
194 \r
195                 /// <summary>\r
196                 /// Returns a value that indicates whether the current instance is equal to the specified object. \r
197                 /// </summary>\r
198                 /// <param name="other">Object to make the comparison with.</param>\r
199                 /// <returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>\r
200                 virtual bool Equals( BoundingBox other );\r
201 \r
202                 /// <summary>\r
203                 /// Determines whether the specified object instances are considered equal. \r
204                 /// </summary>\r
205                 /// <param name="value1"></param>\r
206                 /// <param name="value2"></param>\r
207                 /// <returns><c>true</c> if <paramref name="value1"/> is the same instance as <paramref name="value2"/> or \r
208                 /// if both are <c>null</c> references or if <c>value1.Equals(value2)</c> returns <c>true</c>; otherwise, <c>false</c>.</returns>\r
209                 static bool Equals( BoundingBox% value1, BoundingBox% value2 );\r
210         };\r
211 }