2019-01-24 14:38:18 +00:00
|
|
|
|
// This source code is property of the Computer Graphics and Visualization
|
|
|
|
|
// chair of the TU Dresden. Do not distribute!
|
2018-09-06 12:35:43 +00:00
|
|
|
|
// Copyright (C) CGV TU Dresden - All Rights Reserved
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
|
#include <Eigen/Core>
|
|
|
|
|
|
|
|
|
|
class GridTraverser
|
|
|
|
|
{
|
|
|
|
|
//ray origin and direction
|
2019-01-24 14:38:18 +00:00
|
|
|
|
Eigen::Vector3f orig, dir;
|
2018-09-06 12:35:43 +00:00
|
|
|
|
//grid cell extents
|
|
|
|
|
Eigen::Vector3f cellExtents;
|
|
|
|
|
//current cell index
|
|
|
|
|
Eigen::Vector3i current;
|
|
|
|
|
|
|
|
|
|
/* you can additional attributes for incremental calculation here */
|
|
|
|
|
|
2019-01-24 14:38:18 +00:00
|
|
|
|
public:
|
2018-09-06 12:35:43 +00:00
|
|
|
|
//default constructor
|
|
|
|
|
GridTraverser();
|
|
|
|
|
|
|
|
|
|
//constructs a grid traverser for a given ray with origin o, and ray direction d for a grid with cell extents ce
|
2019-01-24 14:38:18 +00:00
|
|
|
|
GridTraverser(const Eigen::Vector3f &o, const Eigen::Vector3f &d, const Eigen::Vector3f ce);
|
2018-09-06 12:35:43 +00:00
|
|
|
|
|
|
|
|
|
//accessor of ray origin
|
2019-01-24 14:38:18 +00:00
|
|
|
|
Eigen::Vector3f &Origin();
|
2018-09-06 12:35:43 +00:00
|
|
|
|
|
|
|
|
|
//const accessor of ray origin
|
2019-01-24 14:38:18 +00:00
|
|
|
|
const Eigen::Vector3f &Origin() const;
|
2018-09-06 12:35:43 +00:00
|
|
|
|
|
|
|
|
|
//accessor of ray direction
|
2019-01-24 14:38:18 +00:00
|
|
|
|
Eigen::Vector3f &Direction();
|
|
|
|
|
|
2018-09-06 12:35:43 +00:00
|
|
|
|
//const accessor of ray direction
|
2019-01-24 14:38:18 +00:00
|
|
|
|
const Eigen::Vector3f &Direction() const;
|
2018-09-06 12:35:43 +00:00
|
|
|
|
|
|
|
|
|
//set cell extents
|
2019-01-24 14:38:18 +00:00
|
|
|
|
void SetCellExtents(const Eigen::Vector3f &cellExtent);
|
2018-09-06 12:35:43 +00:00
|
|
|
|
|
|
|
|
|
//init at origin cell
|
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
|
|
//step to next cell along ray direction
|
|
|
|
|
void operator++(int);
|
|
|
|
|
|
|
|
|
|
//return current cell index
|
2019-01-24 14:38:18 +00:00
|
|
|
|
Eigen::Vector3i operator*();
|
2018-09-06 12:35:43 +00:00
|
|
|
|
};
|