@ -1062,3 +1062,25 @@ GPoint3 GLine::operator()(const float t) const
{
return p + v*t;
}
GLine & GLine::SetPt(const GPoint3 & _p)
p = _p;
return *this;
GLine & GLine::SetDir(const GVector3 & _v)
v = _v;
GVector3 GLine::GetPt() const
return p;
GVector3 GLine::GetDir() const
return v;
@ -216,4 +216,10 @@ public:
GLine& operator =(const GLine& rhs);
GPoint3 operator ()(const float t) const;
GLine& SetPt(const GPoint3& _p);
GLine& SetDir(const GVector3& _v);
GVector3 GetPt() const;
GVector3 GetDir() const;
};
@ -6,6 +6,11 @@ int main() {
GPoint3 p = l(2.0f);
cout << p << endl;
l.SetPt(GPoint3(0.0f, 0.0f, 1.0f));
l.SetDir(GVector3(1.0f, 0.0f, 0.0f));
GPoint3 q = l(1.0f);
cout << q << endl;
return 0;