29 lines
454 B
C++
29 lines
454 B
C++
|
#include "LineSegment.h"
|
||
|
|
||
|
LineSegment::LineSegment(PointPtr p0, PointPtr p1)
|
||
|
: mP0(p0),
|
||
|
mP1(p1)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
std::shared_ptr<LineSegment> LineSegment::Create(PointPtr p0, PointPtr p1)
|
||
|
{
|
||
|
return std::make_shared<LineSegment>(p0, p1);
|
||
|
}
|
||
|
|
||
|
double LineSegment::getLength() const
|
||
|
{
|
||
|
return mP0->getDistance(mP1.get());
|
||
|
}
|
||
|
|
||
|
Point* LineSegment::getPoint0() const
|
||
|
{
|
||
|
return mP0.get();
|
||
|
}
|
||
|
|
||
|
Point* LineSegment::getPoint1() const
|
||
|
{
|
||
|
return mP1.get();
|
||
|
}
|