IceSegment.h
Go to the documentation of this file.
00001 
00002 
00008 
00009 
00011 // Include Guard
00012 #ifndef __ICESEGMENT_H__
00013 #define __ICESEGMENT_H__
00014 
00015         class ICEMATHS_API Segment
00016         {
00017                 public:
00019                 inline_                                 Segment()                                                                                                                       {}
00021                 inline_                                 Segment(const Point& p0, const Point& p1) : mP0(p0), mP1(p1)            {}
00023                 inline_                                 Segment(const Segment& seg) : mP0(seg.mP0), mP1(seg.mP1)                        {}
00025                 inline_                                 ~Segment()                                                                                                                      {}
00026 
00027                 inline_ const   Point&  GetOrigin()                                             const   { return mP0;                                           }
00028                 inline_                 Point   ComputeDirection()                              const   { return mP1 - mP0;                                     }
00029                 inline_                 void    ComputeDirection(Point& dir)    const   { dir = mP1 - mP0;                                      }
00030                 inline_                 float   ComputeLength()                                 const   { return mP1.Distance(mP0);                     }
00031                 inline_                 float   ComputeSquareLength()                   const   { return mP1.SquareDistance(mP0);       }
00032 
00033                 inline_                 void    SetOriginDirection(const Point& origin, const Point& direction)
00034                                                                 {
00035                                                                         mP0 = mP1 = origin;
00036                                                                         mP1 += direction;
00037                                                                 }
00038 
00040 
00045 
00046                 inline_                 void    ComputePoint(Point& pt, float t)        const   {       pt = mP0 + t * (mP1 - mP0);             }
00047 
00048                                                 float   SquareDistance(const Point& point, float* t=null)       const;
00049                 inline_                 float   Distance(const Point& point, float* t=null)                     const                   { return sqrtf(SquareDistance(point, t));       }
00050 
00051                                                 Point   mP0;            
00052                                                 Point   mP1;            
00053         };
00054 
00055 #endif // __ICESEGMENT_H__


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sun Apr 2 2017 03:43:54