#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2015 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 */ #pragma endregion // CPL License #ifndef NUCLEX_GEOMETRY_VOLUMES_GENERATORS_CYLINDER3GENERATOR_H #define NUCLEX_GEOMETRY_VOLUMES_GENERATORS_CYLINDER3GENERATOR_H #include "Nuclex/Geometry/Config.h" #include "Nuclex/Geometry/Volumes/Box3.h" #include "Nuclex/Geometry/Volumes/Sphere3.h" #include "Nuclex/Geometry/Volumes/Cylinder3.h" namespace Nuclex { namespace Geometry { namespace Volumes { namespace Generators { // ------------------------------------------------------------------------------------------- // /// Point and volume generation methods for 3D cylinders template class Cylinder3Generator { /// Generates a random point within a cylinder /// Cylinder in which a random point will be generated /// Random number generator that will be used /// A random point inside the cylinder public: template Point3 static GetRandomPointInside(const Cylinder3 &cylinder, TRandomNumberEngine &random) { } /// Generates a random point on the hull of a cylinder /// Cylinder on which a random point will be generated /// Random number generator that will be used /// A random point on the hull of the cylinder public: template Point3 static GetRandomPointOnHull(const Cylinder3 &cylinder, TRandomNumberEngine &random) { } /// Returns the closest point to another point within the cylinder /// Cylinder within which the closest point will be determined /// Point to which the closest point will be determined /// The closest point within the cylinder to the provided point public: static Point3 GetClosestPointInside( const Cylinder3 &cylinder, const Point3 &point ) { } /// Returns the closest point to another point on the cylinder's hull /// Cylinder on whose hull the closest point will be determined /// Point to which the closest point will be determined /// The closest point on the cylinder's hull to the provided point public: static Point3 GetClosestPointOnHull( const Cylinder3 &cylinder, const Point3 &point ) { } /// Calculates the bounding box of the specified cylinder /// Cylinder of which the bounding box will be calculated /// The bounding box of the specified cylinder public: static Box3 GetBoundingBox(const Cylinder3 &cylinder) { return Box3::FromMinAndMax( cylinder.Center.X - cylinder.Radius, cylinder.Center.Y - cylinder.Radius, cylinder.Center.Z - cylinder.Height, cylinder.Center.X + cylinder.Radius, cylinder.Center.Y + cylinder.Radius, cylinder.Center.Z + cylinder.Height ); } /// Calculates the bounding sphere of the specified cylinder /// Cylinder of which the bounding sphere will be calculated /// The bounding sphere of the specified cylinder public: static Box3 GetBoundingSphere(const Cylinder3 &cylinder) { TScalar radius = Math::SquareRoot( (cylinder.Height * cylinder.Height) + (cylinder.Radius * cylinder.Radius) ); return Sphere3(cylinder.Center, radius); } }; // ------------------------------------------------------------------------------------------- // }}}} // namespace Nuclex::Geometry::Volumes::Generators #endif // NUCLEX_GEOMETRY_VOLUMES_GENERATORS_CYLINDER3GENERATOR_H