IceSegment.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICESEGMENT_H__
13 #define __ICESEGMENT_H__
14 
16  {
17  public:
21  inline_ Segment(const Point& p0, const Point& p1) : mP0(p0), mP1(p1) {}
23  inline_ Segment(const Segment& seg) : mP0(seg.mP0), mP1(seg.mP1) {}
26 
27  inline_ const Point& GetOrigin() const { return mP0; }
28  inline_ Point ComputeDirection() const { return mP1 - mP0; }
29  inline_ void ComputeDirection(Point& dir) const { dir = mP1 - mP0; }
30  inline_ float ComputeLength() const { return mP1.Distance(mP0); }
31  inline_ float ComputeSquareLength() const { return mP1.SquareDistance(mP0); }
32 
33  inline_ void SetOriginDirection(const Point& origin, const Point& direction)
34  {
35  mP0 = mP1 = origin;
36  mP1 += direction;
37  }
38 
40 
45  inline_ void ComputePoint(Point& pt, float t) const { pt = mP0 + t * (mP1 - mP0); }
47 
48  float SquareDistance(const Point& point, float* t=null) const;
49  inline_ float Distance(const Point& point, float* t=null) const { return sqrtf(SquareDistance(point, t)); }
50 
53  };
54 
55 #endif // __ICESEGMENT_H__
Segment::Distance
inline_ float Distance(const Point &point, float *t=null) const
Definition: IceSegment.h:49
Segment::GetOrigin
const inline_ Point & GetOrigin() const
Definition: IceSegment.h:27
Segment::mP0
Point mP0
Start of segment.
Definition: IceSegment.h:51
Segment::mP1
Point mP1
End of segment.
Definition: IceSegment.h:52
Segment::Segment
inline_ Segment(const Segment &seg)
Copy constructor.
Definition: IceSegment.h:23
Segment
Definition: IceSegment.h:15
Segment::ComputeDirection
inline_ Point ComputeDirection() const
Definition: IceSegment.h:28
Segment::Segment
inline_ Segment()
Constructor.
Definition: IceSegment.h:19
Segment::ComputeLength
inline_ float ComputeLength() const
Definition: IceSegment.h:30
Segment::ComputeDirection
inline_ void ComputeDirection(Point &dir) const
Definition: IceSegment.h:29
Segment::SetOriginDirection
inline_ void SetOriginDirection(const Point &origin, const Point &direction)
Definition: IceSegment.h:33
Segment::ComputeSquareLength
inline_ float ComputeSquareLength() const
Definition: IceSegment.h:31
ICEMATHS_API
#define ICEMATHS_API
Definition: OPC_IceHook.h:51
Segment::~Segment
inline_ ~Segment()
Destructor.
Definition: IceSegment.h:25
Point
Definition: IcePoint.h:25
Segment::Segment
inline_ Segment(const Point &p0, const Point &p1)
Constructor.
Definition: IceSegment.h:21
inline_
#define inline_
Definition: IcePreprocessor.h:103


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:03