20 #if !defined(__MITSUBA_CORE_SFCURVE_H_)
21 #define __MITSUBA_CORE_SFCURVE_H_
53 m_points.reserve(m_size.x*m_size.y);
58 ENorth, EEast, ESouth, EWest);
67 inline const std::vector<PointType> &
getPoints()
const {
73 return m_points.size();
83 case ENorth: m_pos.y--;
break;
84 case EEast: m_pos.x++;
break;
85 case ESouth: m_pos.y++;
break;
86 case EWest: m_pos.x--;
break;
94 if (m_pos.x < m_size.x && m_pos.y < m_size.y)
95 m_points.push_back(m_pos);
97 generate(order-1, left, back, right, front); move(right);
98 generate(order-1, front, right, back, left); move(back);
99 generate(order-1, front, right, back, left); move(left);
100 generate(order-1, right, front, left, back);
106 std::vector<PointType> m_points;
float fastlog(float value)
Definition: math.h:209
const PointType & operator[](size_t idx) const
Return one of the generated points.
Definition: sfcurve.h:62
const std::vector< PointType > & getPoints() const
Return a reference to the computed points.
Definition: sfcurve.h:67
HilbertCurve2D()
Create an empty Hilbert curve.
Definition: sfcurve.h:46
void generate(int order, EDirection front, EDirection right, EDirection back, EDirection left)
Definition: sfcurve.h:90
const VectorType & getSize() const
Return the size of the underlying 2D rectangle.
Definition: sfcurve.h:77
TPoint2< T > PointType
Definition: sfcurve.h:43
void initialize(const VectorType &size)
Initialize for the specified 2D size.
Definition: sfcurve.h:49
Parameterizable two-dimensional point data structure.
Definition: point.h:222
size_t getPointCount() const
Return the total number of points.
Definition: sfcurve.h:72
void move(EDirection dir)
Definition: sfcurve.h:81
Parameterizable two-dimensional vector data structure.
Definition: vector.h:246
TVector2< T > VectorType
Definition: sfcurve.h:42
EDirection
Definition: sfcurve.h:36
2D version of the Hilbert space-filling curve
Definition: sfcurve.h:34