#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_CYLINDER3_H
#define NUCLEX_GEOMETRY_VOLUMES_CYLINDER3_H
#include "../Point3.h"
namespace Nuclex { namespace Geometry { namespace Volumes {
// ------------------------------------------------------------------------------------------- //
/// Cylinder in 3D space stored as a position, radius and height
template
struct Cylinder3 {
/// Initializes a cylinder using the specified position, radius and height
/// Position of the cylinder's center point
/// Radius of the cylinder
/// Height of the cylinder
public: Cylinder3(const Point3 ¢er, TScalar radius, TScalar height) :
Center(center), Radius(radius), Height(height) {}
/// Offsets the entire sphere by the specified amount
/// Amount the sphere will be offset on the X axis
/// Amount the sphere will be offset on the Y axis
/// Amount the sphere will be offset on the Z axis
public: void ShiftBy(TScalar amountX, TScalar amountY, TScalar amountZ) {
this->Center.X += amountX;
this->Center.Y += amountY;
this->Center.Z += amountZ;
}
/// Offsets the entire sphere by the specified amount
/// Amount the sphere will be offset
public: void ShiftBy(const Vector3 &amount) {
this->Center += amount;
}
/// Coordinates of the cylinder's center
public: Point3 Center;
/// Radius of the cylinder
public: TScalar Radius;
/// Height of the cylinder
public: TScalar Height;
};
// ------------------------------------------------------------------------------------------- //
}}} // namespace Nuclex::Geometry::Volumes
#endif // NUCLEX_GEOMETRY_VOLUMES_CYLINDER3_H