Line segment in two dimensions.  
 More...
#include <JSegment3D.hh>
Line segment in two dimensions. 
Definition at line 33 of file JSegment3D.hh.
 
◆ JSegment3D() [1/2]
  
  
      
        
          | JGEOMETRY3D::JSegment3D::JSegment3D  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Default constructor. 
Definition at line 40 of file JSegment3D.hh.
   40                 :
   42    {}
std::pair< JPosition3D, JPosition3D > JSegment3D_t
Type definition of line segment in two dimensions.
 
 
 
 
◆ JSegment3D() [2/2]
Constructor. 
- Parameters
 - 
  
    | A | start position  | 
    | B | end position  | 
  
   
Definition at line 51 of file JSegment3D.hh.
 
 
◆ getLengthSquared()
  
  
      
        
          | double JGEOMETRY3D::JSegment3D::getLengthSquared  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get length squared. 
- Returns
 - square of length 
 
Definition at line 62 of file JSegment3D.hh.
   63    {
   64      return JVector3D(this->second - this->first).getLengthSquared();
   65    }
 
 
 
◆ getLength()
  
  
      
        
          | double JGEOMETRY3D::JSegment3D::getLength  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get length. 
- Returns
 - length 
 
Definition at line 73 of file JSegment3D.hh.
   74    {
   76    }
double getLengthSquared() const
Get length squared.
 
 
 
 
◆ getDistanceSquared()
  
  
      
        
          | double JGEOMETRY3D::JSegment3D::getDistanceSquared  | 
          ( | 
          const JVector3D & |           point,  | 
         
        
           | 
           | 
          const double |           precision = 1.0e-8 ) const | 
         
       
   | 
  
inline   | 
  
 
Get squared of distance to point. 
- Parameters
 - 
  
    | point | point  | 
    | precision | precision  | 
  
   
- Returns
 - square of distance 
 
Definition at line 86 of file JSegment3D.hh.
   87    {
   88      JVector3D D(this->second - this->first);
   89 
   90      const double gp = D.getLengthSquared();
   91 
   92      if (gp > precision) {
   93 
   94        const JVector3D U(point - this->first);
   95 
   96        double u = D.getDot(U);
 
   97 
   98        if      (u < 0.0)
  100        else if (u > gp)
  102        else
  104 
  105        D.mul(u);
  106        D.sub(U);
  107 
  108        return D.getLengthSquared();
  109 
  110      } else {
  111 
  112        return this->first.getDistanceSquared(point);
  113      }
  114    }
 
 
 
◆ getDistance()
  
  
      
        
          | double JGEOMETRY3D::JSegment3D::getDistance  | 
          ( | 
          const JVector3D & |           point | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get distance to point. 
- Parameters
 - 
  
  
 
- Returns
 - distance 
 
Definition at line 123 of file JSegment3D.hh.
  124    {
  126    }
double getDistanceSquared(const JVector3D &point, const double precision=1.0e-8) const
Get squared of distance to point.
 
 
 
 
◆ getDot()
  
  
      
        
          | double JGEOMETRY3D::JSegment3D::getDot  | 
          ( | 
          const JSegment3D & |           segment | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get dot product. 
- Parameters
 - 
  
  
 
- Returns
 - dot product 
 
Definition at line 135 of file JSegment3D.hh.
  136    {
  137      return JVector3D(this->second - this->first).getDot(segment.second - segment.first);
  138    }
 
 
 
◆ operator>>
Read segment from input. 
- Parameters
 - 
  
  
 
- Returns
 - reader 
 
Definition at line 148 of file JSegment3D.hh.
  149    {
  150      in >> segment.first;
  151      in >> segment.second;
  152 
  153      return in;
  154    }
 
 
 
◆ operator<<
Write segment to output. 
- Parameters
 - 
  
  
 
- Returns
 - writer 
 
Definition at line 164 of file JSegment3D.hh.
  165    {
  166      out << segment.first;
  167      out << segment.second;
  168 
  169      return out;
  170    }
 
 
 
The documentation for this class was generated from the following file: