Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/vector.cpp

    r7b36fe rb34306  
    1515#include "vector.hpp"
    1616#include "verbose.hpp"
     17#include "World.hpp"
    1718
    1819#include <gsl/gsl_linalg.h>
     
    2627 */
    2728Vector::Vector() { x[0] = x[1] = x[2] = 0.; };
     29
     30/** Constructor of class vector.
     31 */
     32Vector::Vector(const Vector * const a)
     33{
     34  x[0] = a->x[0];
     35  x[1] = a->x[1];
     36  x[2] = a->x[2];
     37};
     38
     39/** Constructor of class vector.
     40 */
     41Vector::Vector(const Vector &a)
     42{
     43  x[0] = a.x[0];
     44  x[1] = a.x[1];
     45  x[2] = a.x[2];
     46};
    2847
    2948/** Constructor of class vector.
     
    267286};
    268287
    269 /** Calculates the minimum distance of this vector to the plane.
     288/** Calculates the minimum distance vector of this vector to the plane.
    270289 * \param *out output stream for debugging
    271290 * \param *PlaneNormal normal of plane
    272291 * \param *PlaneOffset offset of plane
    273  * \return distance to plane
    274  */
    275 double Vector::DistanceToPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset) const
     292 * \return distance vector onto to plane
     293 */
     294Vector Vector::GetDistanceVectorToPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset) const
    276295{
    277296  Vector temp;
     
    291310    sign = 0.;
    292311
    293   return (temp.Norm()*sign);
     312  temp.Normalize();
     313  temp.Scale(sign);
     314  return temp;
     315};
     316
     317/** Calculates the minimum distance of this vector to the plane.
     318 * \sa Vector::GetDistanceVectorToPlane()
     319 * \param *out output stream for debugging
     320 * \param *PlaneNormal normal of plane
     321 * \param *PlaneOffset offset of plane
     322 * \return distance to plane
     323 */
     324double Vector::DistanceToPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset) const
     325{
     326  return GetDistanceVectorToPlane(PlaneNormal,PlaneOffset).Norm();
    294327};
    295328
Note: See TracChangeset for help on using the changeset viewer.