OSDN Git Service

#36897 [DTXC] MIDIインポート機能の呼び出し口を、ファイルメニュー内にも配置。
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / math / BoundingSphere.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/BoundingSphereConverter.h"\r
25 \r
26 #include "Enums.h"\r
27 #include "Vector3.h"\r
28 \r
29 namespace SlimDX\r
30 {\r
31         value class BoundingBox;\r
32         value class Plane;\r
33         value class Ray;\r
34         \r
35         /// <summary>\r
36         /// A bounding sphere, specified by a center vector and a radius.\r
37         /// </summary>\r
38         /// <unmanaged>None</unmanaged>\r
39         [System::Serializable]\r
40         [System::Runtime::InteropServices::StructLayout( System::Runtime::InteropServices::LayoutKind::Sequential )]\r
41         [System::ComponentModel::TypeConverter( SlimDX::Design::BoundingSphereConverter::typeid )]\r
42         public value class BoundingSphere : System::IEquatable<BoundingSphere>\r
43         {\r
44         public:\r
45                 /// <summary>\r
46                 /// Specifies the center point of the sphere.\r
47                 /// </summary>\r
48                 Vector3 Center;\r
49 \r
50                 /// <summary>\r
51                 /// The radius of the sphere.\r
52                 /// </summary>\r
53                 float Radius;\r
54 \r
55                 /// <summary>\r
56                 /// Initializes a new instance of the <see cref="BoundingSphere"/> structure.\r
57                 /// </summary>\r
58                 /// <param name="center">The center of the bounding sphere.</param>\r
59                 /// <param name="radius">The radius of the sphere.</param>\r
60                 BoundingSphere( Vector3 center, float radius );\r
61 \r
62                 /// <summary>\r
63                 /// Determines whether the sphere contains the specified box.\r
64                 /// </summary>\r
65                 /// <param name="sphere">The sphere that will be checked for containment.</param>\r
66                 /// <param name="box">The box that will be checked for containment.</param>\r
67                 /// <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
68                 static ContainmentType Contains( BoundingSphere sphere, BoundingBox box );\r
69                 \r
70                 /// <summary>\r
71                 /// Determines whether the sphere contains the specified sphere.\r
72                 /// </summary>\r
73                 /// <param name="sphere1">The first sphere that will be checked for containment.</param>\r
74                 /// <param name="sphere2">The second sphere that will be checked for containment.</param>\r
75                 /// <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
76                 static ContainmentType Contains( BoundingSphere sphere1, BoundingSphere sphere2 );\r
77                 \r
78                 /// <summary>\r
79                 /// Determines whether the sphere contains the specified point.\r
80                 /// </summary>\r
81                 /// <param name="sphere">The sphere that will be checked for containment.</param>\r
82                 /// <param name="vector">The point that will be checked for containment.</param>\r
83                 /// <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
84                 static ContainmentType Contains( BoundingSphere sphere, Vector3 vector );\r
85 \r
86                 /// <summary>\r
87                 /// Constructs a <see cref="BoundingSphere"/> from a given box.\r
88                 /// </summary>\r
89                 /// <param name="box">The box that will designate the extents of the sphere.</param>\r
90                 /// <returns>The newly constructed bounding sphere.</returns>\r
91                 static BoundingSphere FromBox( BoundingBox box );\r
92 \r
93                 /// <summary>\r
94                 /// Constructs a <see cref="BoundingSphere"/> that fully contains the given points.\r
95                 /// </summary>\r
96                 /// <param name="points">The points that will be contained by the sphere.</param>\r
97                 /// <returns>The newly constructed bounding sphere.</returns>\r
98                 static BoundingSphere FromPoints( array<Vector3>^ points );\r
99 \r
100                 /// <summary>\r
101                 /// Constructs a <see cref="BoundingSphere"/> that is the as large as the total combined area of the two specified spheres.\r
102                 /// </summary>\r
103                 /// <param name="sphere1">The first sphere to merge.</param>\r
104                 /// <param name="sphere2">The second sphere to merge.</param>\r
105                 /// <returns>The newly constructed bounding sphere.</returns>\r
106                 static BoundingSphere Merge( BoundingSphere sphere1, BoundingSphere sphere2 );\r
107 \r
108                 /// <summary>\r
109                 /// Determines whether a sphere intersects the specified object.\r
110                 /// </summary>\r
111                 /// <param name="sphere">The sphere which will be tested for intersection.</param>\r
112                 /// <param name="box">The box that will be tested for intersection.</param>\r
113                 /// <returns><c>true</c> if the two objects are intersecting; otherwise, <c>false</c>.</returns>\r
114                 static bool Intersects( BoundingSphere sphere, BoundingBox box );\r
115 \r
116                 /// <summary>\r
117                 /// Determines whether a sphere intersects the specified object.\r
118                 /// </summary>\r
119                 /// <param name="sphere1">The first sphere which will be tested for intersection.</param>\r
120                 /// <param name="sphere2">The second sphere that will be tested for intersection.</param>\r
121                 /// <returns><c>true</c> if the two objects are intersecting; otherwise, <c>false</c>.</returns>\r
122                 static bool Intersects( BoundingSphere sphere1, BoundingSphere sphere2 );\r
123 \r
124                 /// <summary>\r
125                 /// Determines whether a sphere intersects the specified object.\r
126                 /// </summary>\r
127                 /// <param name="sphere">The sphere which will be tested for intersection.</param>\r
128                 /// <param name="ray">The ray that will be tested for intersection.</param>\r
129                 /// <param name="distance">When the method completes, contains the distance from the ray's origin in which the intersection with the sphere occured.</param>\r
130                 /// <returns><c>true</c> if the two objects are intersecting; otherwise, <c>false</c>.</returns>\r
131                 static bool Intersects( BoundingSphere sphere, Ray ray, [Out] float% distance );\r
132 \r
133                 /// <summary>\r
134                 /// Finds the intersection between a plane and a sphere.\r
135                 /// </summary>\r
136                 /// <param name="sphere">The sphere to check for intersection.</param>\r
137                 /// <param name="plane">The source plane.</param>\r
138                 /// <returns>A value from the <see cref="PlaneIntersectionType"/> enumeration describing the result of the intersection test.</returns>\r
139                 static PlaneIntersectionType Intersects( BoundingSphere sphere, Plane plane );\r
140 \r
141                 /// <summary>\r
142                 /// Tests for equality between two objects.\r
143                 /// </summary>\r
144                 /// <param name="left">The first value to compare.</param>\r
145                 /// <param name="right">The second value to compare.</param>\r
146                 /// <returns><c>true</c> if <paramref name="left"/> has the same value as <paramref name="right"/>; otherwise, <c>false</c>.</returns>\r
147                 static bool operator == ( BoundingSphere left, BoundingSphere right );\r
148 \r
149                 /// <summary>\r
150                 /// Tests for inequality between two objects.\r
151                 /// </summary>\r
152                 /// <param name="left">The first value to compare.</param>\r
153                 /// <param name="right">The second value to compare.</param>\r
154                 /// <returns><c>true</c> if <paramref name="left"/> has a different value than <paramref name="right"/>; otherwise, <c>false</c>.</returns>\r
155                 static bool operator != ( BoundingSphere left, BoundingSphere right );\r
156 \r
157                 /// <summary>\r
158                 /// Converts the value of the object to its equivalent string representation.\r
159                 /// </summary>\r
160                 /// <returns>The string representation of the value of this instance.</returns>\r
161                 virtual System::String^ ToString() override;\r
162 \r
163                 /// <summary>\r
164                 /// Returns the hash code for this instance.\r
165                 /// </summary>\r
166                 /// <returns>A 32-bit signed integer hash code.</returns>\r
167                 virtual int GetHashCode() override;\r
168 \r
169                 /// <summary>\r
170                 /// Returns a value that indicates whether the current instance is equal to a specified object. \r
171                 /// </summary>\r
172                 /// <param name="obj">Object to make the comparison with.</param>\r
173                 /// <returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>\r
174                 virtual bool Equals( System::Object^ obj ) override;\r
175 \r
176                 /// <summary>\r
177                 /// Returns a value that indicates whether the current instance is equal to the specified object. \r
178                 /// </summary>\r
179                 /// <param name="other">Object to make the comparison with.</param>\r
180                 /// <returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>\r
181                 virtual bool Equals( BoundingSphere other );\r
182 \r
183                 /// <summary>\r
184                 /// Determines whether the specified object instances are considered equal. \r
185                 /// </summary>\r
186                 /// <param name="value1"></param>\r
187                 /// <param name="value2"></param>\r
188                 /// <returns><c>true</c> if <paramref name="value1"/> is the same instance as <paramref name="value2"/> or \r
189                 /// if both are <c>null</c> references or if <c>value1.Equals(value2)</c> returns <c>true</c>; otherwise, <c>false</c>.</returns>\r
190                 static bool Equals( BoundingSphere% value1, BoundingSphere% value2 );\r
191         };\r
192 }