Point3D.h

// -*- C++ -*-
// CLASSDOC OFF
// $Id: Point3D.h,v 1.8 1999/04/06 17:13:34 evc Exp $
// ---------------------------------------------------------------------------
// CLASSDOC ON
//
// Hep geometrical 3D Point class
//
// This file is part of Geant4 (simulation toolkit for HEP).
// 
// Author: Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch>
//
// History:
// 09.09.96 E.Chernyaev - initial version

#ifndef HepPoint3D_hh
#define HepPoint3D_hh

#include "CLHEP/config/CLHEP.h"
#include "CLHEP/Vector/ThreeVector.h"

class HepTransform3D;

class HepPoint3D : public Hep3Vector {       
 public:
  // Constructor
  HepPoint3D(HepDouble x=0, HepDouble y=0, HepDouble z=0)
    : Hep3Vector(x, y, z) {}

  // Copy constructor
  HepPoint3D(const Hep3Vector &v) : Hep3Vector(v) {}

  // Destructor
  ~HepPoint3D() {};

  // Assignment
  HepPoint3D& operator=(const HepPoint3D &v) {
    setX(v.x()); setY(v.y()); setZ(v.z()); return *this;
  }

  // Assignment of Hep3Vector and classes derived from it (Vector3D, Normal3D)
  HepPoint3D& operator=(const Hep3Vector &v) {
    setX(v.x()); setY(v.y()); setZ(v.z()); return *this;
  }
 
  // Distance squared to the origin
  HepDouble distance2() const { return mag2(); }

  // Distance squared to the point
  HepDouble distance2(const HepPoint3D &p) const {
    HepDouble delx = p.x()-x(), dely = p.y()-y(), delz = p.z()-z();
    return delx*delx + dely*dely + delz*delz;
  }

  // Distance to the origin
  HepDouble distance() const { return sqrt(distance2()); }

  // Distance to the point
  HepDouble distance(const HepPoint3D &p) const { return sqrt(distance2(p)); }

  // Transformation
  HepPoint3D& transform(const HepTransform3D &m);
};

#include "CLHEP/Geometry/Transform3D.h"

inline HepPoint3D& HepPoint3D::transform(const HepTransform3D &m) {
  return *this = m * (*this);
}

#endif /* HepPoint3D_hh */

Generated by GNU enscript 1.6.1.