#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_LINES_LINE3_H #define NUCLEX_GEOMETRY_LINES_LINE3_H #include "Nuclex/Geometry/Config.h" #include "Nuclex/Geometry/Point3.h" #include "Nuclex/Geometry/Vector3.h" namespace Nuclex { namespace Geometry { namespace Lines { // ------------------------------------------------------------------------------------------- // /// 3D line defined by an offset point and a direction template struct Line3 { /// Initializes a line using the specified coordinates /// Offset point at which the line starts /// Direction into which the ray extends public: Line3(const Point3 &origin, const Vector3 &direction) : Origin(origin), Direction(direction) {} /// Offsets the entire line by the specified amount /// Amount the line will be offset on the X axis /// Amount the line will be offset on the Y axis /// Amount the line will be offset on the Z axis public: void ShiftBy(TScalar offsetX, TScalar offsetY, TScalar offsetZ) { this->Origin.X += offsetX; this->Origin.Y += offsetY; this->Origin.Z += offsetZ; } /// Offsets the entire line by the specified amount /// Amount the line will be offset public: void ShiftBy(const Vector3 &offset) { this->Origin += offset; } /// Coordinates at which the line begins public: Point3 Origin; /// Direction into which the line entends public: Vector3 Direction; }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Geometry::Lines #endif // NUCLEX_GEOMETRY_LINES_LINE3_H