You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.0 KiB
77 lines
1.0 KiB
3 months ago
|
|
||
|
|
||
|
#include "oc_point.h"
|
||
|
|
||
|
namespace opencorr
|
||
|
{
|
||
|
//Point2D
|
||
|
Point2D::Point2D()
|
||
|
{
|
||
|
x = 0.f;
|
||
|
y = 0.f;
|
||
|
}
|
||
|
|
||
|
Point2D::Point2D(float x, float y)
|
||
|
{
|
||
|
this->x = x;
|
||
|
this->y = y;
|
||
|
}
|
||
|
|
||
|
Point2D::Point2D(int x, int y)
|
||
|
{
|
||
|
this->x = (float)x;
|
||
|
this->y = (float)y;
|
||
|
}
|
||
|
|
||
|
Point2D::~Point2D() {}
|
||
|
|
||
|
float Point2D::vectorNorm() const
|
||
|
{
|
||
|
return sqrt(x * x + y * y);
|
||
|
}
|
||
|
|
||
|
std::ostream& operator<<(std::ostream& output, const Point2D& point)
|
||
|
{
|
||
|
output << point.x << "," << point.y;
|
||
|
return output;
|
||
|
}
|
||
|
|
||
|
|
||
|
//Point3D
|
||
|
Point3D::Point3D()
|
||
|
{
|
||
|
x = 0.f;
|
||
|
y = 0.f;
|
||
|
z = 0.f;
|
||
|
}
|
||
|
|
||
|
Point3D::Point3D(float x, float y, float z)
|
||
|
{
|
||
|
this->x = x;
|
||
|
this->y = y;
|
||
|
this->z = z;
|
||
|
}
|
||
|
|
||
|
Point3D::Point3D(int x, int y, int z)
|
||
|
{
|
||
|
this->x = (float)x;
|
||
|
this->y = (float)y;
|
||
|
this->z = (float)z;
|
||
|
}
|
||
|
|
||
|
Point3D::~Point3D() {}
|
||
|
|
||
|
float Point3D::vectorNorm() const
|
||
|
{
|
||
|
return sqrt(x * x + y * y + z * z);
|
||
|
}
|
||
|
|
||
|
std::ostream& operator<<(std::ostream& output, const Point3D& point)
|
||
|
{
|
||
|
output << point.x << "," << point.y << "," << point.z;
|
||
|
return output;
|
||
|
}
|
||
|
|
||
|
}//namespace opencorr
|
||
|
|