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