#region CPL License /* Nuclex Framework Copyright (C) 2002-2009 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #endregion using System; using Microsoft.Xna.Framework; namespace Nuclex.Geometry.Volumes { /// A point of contact between two volumes public struct ContactPoint { /// The absolute location where the contact occurs public Vector3 Location; /// The time at which the contact occurs public double Time; } /// Three-dimensional geometric body public interface IVolume3 { /// Accepts a visitor to access the concrete volume implementation /// Visitor to be accepted void Accept(VolumeVisitor visitor); /// Smallest axis-aligned box that completely encloses the volume /// /// This always produces an optimal box which means a tight-fitting box is generated /// that will touch the volume on each of its six sides. As a side effect, it is very /// likely that this box needs to be recalculated whenever the volume changes its /// orientation. /// AxisAlignedBox3 BoundingBox { get; } /// Smallest sphere that completely encloses the volume /// /// Bounding spheres have the advantage to not change even when the volume is /// rotated. That makes them ideal for dynamic objects that are not keeping their /// original orientation. /// Sphere3 BoundingSphere { get; } /// Amount of mass that the volume contains /// /// This is the mass the volume would have at a material density of 1.0 /// float Mass { get; } /// The volume's total surface area float SurfaceArea { get; } /// Center of the volume's mass Vector3 CenterOfMass { get; } /// The inetria tensor matrix of the volume Matrix InertiaTensor { get; } /// Locates the nearest point in the volume to some arbitrary location /// Location to which the closest point is determined /// The closest point in the volume to the specified location Vector3 ClosestPointTo(Vector3 location); /// Determines if the volume clips the circle /// Circle that will be checked for intersection /// True if the objects overlap bool Intersects(Sphere3 sphere); /// Determines if the volume clips the axis aligned box /// Box that will be checked for intersection /// True if the objects overlap bool Intersects(AxisAlignedBox3 box); /// Determines if the volume clips the box /// Box that will be checked for intersection /// True if the objects overlap bool Intersects(Box3 box); /// Returns a random point on the volume's surface /// Random number generator that will be used /// A random point on the volume's surface Vector3 RandomPointOnSurface(IRandom randomNumberGenerator); /// Returns a random point within the volume /// Random number generator that will be used /// A random point within the volume Vector3 RandomPointWithin(IRandom randomNumberGenerator); } } // namespace Nuclex.Geometry.Volumes