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.
 
 
 

36 lines
746 B

#include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier
#include "Geometry.h"
AABB::AABB()
{
min= Vec3f(1e5,1e5,1e5);
max= Vec3f(0,0,0);
}
LineSegment::LineSegment(const Vec3f &s, const Vec3f &e):start(s), end(e) {
calculate();
}
float LineSegment::getLength() const {
return length;
}
Vec3f LineSegment::getDir() const {
return dir;
}
void LineSegment::calculate(){
Vec3f diff =end-start;
length =diff.length();
dir=diff.norm();
}
FaceCenterComparator::FaceCenterComparator(const std::vector<Vec3f>& centers, int axis)
: faceCenters(centers), longAxis(axis) {}
bool FaceCenterComparator::operator()(const size_t& a, const size_t& b) const {
return faceCenters[a][longAxis] < faceCenters[b][longAxis];
}