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__
inline_ Point ComputeDirection() const
Definition: IceSegment.h:28
inline_ const Point & GetOrigin() const
Definition: IceSegment.h:27
#define null
our own NULL pointer
Definition: IceTypes.h:57
#define inline_
inline_ ~Segment()
Destructor.
Definition: IceSegment.h:25
Point mP1
End of segment.
Definition: IceSegment.h:52
Definition: IcePoint.h:25
#define ICEMATHS_API
Definition: OPC_IceHook.h:51
inline_ void SetOriginDirection(const Point &origin, const Point &direction)
Definition: IceSegment.h:33
inline_ Segment(const Segment &seg)
Copy constructor.
Definition: IceSegment.h:23
t
inline_ Segment(const Point &p0, const Point &p1)
Constructor.
Definition: IceSegment.h:21
inline_ Segment()
Constructor.
Definition: IceSegment.h:19
inline_ void ComputeDirection(Point &dir) const
Definition: IceSegment.h:29
inline_ float ComputeLength() const
Definition: IceSegment.h:30
Point mP0
Start of segment.
Definition: IceSegment.h:51
inline_ float Distance(const Point &point, float *t=null) const
Definition: IceSegment.h:49
inline_ float ComputeSquareLength() const
Definition: IceSegment.h:31


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:38