Blender
V3.3
|
#include <Grid.h>
Public Member Functions | |
Grid () | |
virtual | ~Grid () |
virtual void | clear () |
virtual void | configure (const Vec3r &orig, const Vec3r &size, unsigned nb) |
void | getCellCoordinates (const Vec3r &p, Vec3u &res) |
virtual void | fillCell (const Vec3u &coord, Cell &cell)=0 |
virtual Cell * | getCell (const Vec3u &coord)=0 |
Cell * | getCell (const Vec3r &p) |
void | getCellOrigin (const Vec3u &cell_coord, Vec3r &orig) |
void | getCellBox (const Vec3u &cell_coord, Vec3r &min_out, Vec3r &max_out) |
void | insertOccluder (Polygon3r *occluder) |
void | addOccluder (Polygon3r *occluder) |
void | castRay (const Vec3r &orig, const Vec3r &end, OccludersSet &occluders, unsigned timestamp) |
void | initAcceleratedRay (const Vec3r &orig, const Vec3r &end, unsigned timestamp) |
void | castInfiniteRay (const Vec3r &orig, const Vec3r &dir, OccludersSet &occluders, unsigned timestamp) |
bool | initAcceleratedInfiniteRay (const Vec3r &orig, const Vec3r &dir, unsigned timestamp) |
Polygon3r * | castRayToFindFirstIntersection (const Vec3r &orig, const Vec3r &dir, double &t, double &u, double &v, unsigned timestamp) |
void | initRay (const Vec3r &orig, const Vec3r &end, unsigned timestamp) |
bool | initInfiniteRay (const Vec3r &orig, const Vec3r &dir, unsigned timestamp) |
const Vec3r & | getOrigin () const |
Vec3r | gridSize () const |
Vec3r | getCellSize () const |
OccludersSet * | getOccluders () |
void | displayDebug () |
Protected Member Functions | |
void | castRayInternal (GridVisitor &visitor) |
bool | nextRayCell (Vec3u ¤t_cell, Vec3u &next_cell) |
Protected Attributes | |
unsigned int | _timestamp |
Vec3u | _cells_nb |
Vec3r | _cell_size |
Vec3r | _size |
Vec3r | _orig |
Vec3r | _ray_dir |
Vec3u | _current_cell |
Vec3r | _pt |
real | _t_end |
real | _t |
OccludersSet | _occluders |
|
inline |
Builds a Grid. Must be followed by a call to configure()
|
inlinevirtual |
void Freestyle::Grid::castInfiniteRay | ( | const Vec3r & | orig, |
const Vec3r & | dir, | ||
OccludersSet & | occluders, | ||
unsigned | timestamp | ||
) |
Casts an infinite ray (still finishing at the end of the grid) from a starting point and in a given direction. Returns the list of occluders contained in the cells intersected by this ray Starts with a call to InitRay.
Definition at line 293 of file Grid.cpp.
References Freestyle::VecMat::Vec< T, N >::norm().
Referenced by Freestyle::ViewMapBuilder::FindOccludee().
void Freestyle::Grid::castRay | ( | const Vec3r & | orig, |
const Vec3r & | end, | ||
OccludersSet & | occluders, | ||
unsigned | timestamp | ||
) |
Casts a ray between a starting point and an ending point Returns the list of occluders contained in the cells intersected by this ray Starts with a call to InitRay.
Definition at line 283 of file Grid.cpp.
Referenced by Freestyle::ViewMapBuilder::ComputeRayCastingVisibility().
|
inlineprotected |
Core of castRay and castInfiniteRay, find occluders along the given ray
Definition at line 352 of file Grid.h.
References Freestyle::GridVisitor::discoverCell(), Freestyle::GridVisitor::examineOccluder(), Freestyle::GridVisitor::finishCell(), Freestyle::Cell::getOccluders(), NULL, POINTER_AS_UINT, POINTER_FROM_UINT, and Freestyle::GridVisitor::stop().
Polygon3r * Freestyle::Grid::castRayToFindFirstIntersection | ( | const Vec3r & | orig, |
const Vec3r & | dir, | ||
double & | t, | ||
double & | u, | ||
double & | v, | ||
unsigned | timestamp | ||
) |
Casts an infinite ray (still finishing at the end of the grid) from a starting point and in a given direction. Returns the first intersection (occluder,t,u,v) or null. Starts with a call to InitRay.
Definition at line 307 of file Grid.cpp.
References Freestyle::VecMat::Vec< T, N >::norm(), Freestyle::firstIntersectionGridVisitor::occluder(), t, Freestyle::firstIntersectionGridVisitor::t_, Freestyle::firstIntersectionGridVisitor::u_, v, and Freestyle::firstIntersectionGridVisitor::v_.
|
virtual |
clears the grid Deletes all the cells, clears the hashtable, resets size, size of cell, number of cells.
Reimplemented in Freestyle::HashGrid, and Freestyle::FastGrid.
Definition at line 80 of file Grid.cpp.
Referenced by Freestyle::FastGrid::clear(), and Freestyle::HashGrid::clear().
Sets the different parameters of the grid orig The grid origin size The grid's dimensions nb The number of cells of the grid
Reimplemented in Freestyle::HashGrid, and Freestyle::FastGrid.
Definition at line 96 of file Grid.cpp.
References blender::math::floor(), min, pow(), and size().
Referenced by Freestyle::FastGrid::configure(), and Freestyle::HashGrid::configure().
Fills the case corresponding to coord with the cell
Implemented in Freestyle::HashGrid, and Freestyle::FastGrid.
returns the cell whose coordinates are passed as argument
Implemented in Freestyle::HashGrid, and Freestyle::FastGrid.
|
inline |
Retrieves the box corresponding to the cell whose coordinates are passed as argument: cell_coord i,j,k integer coordinates for the cell min_out The min x,y,x vector of the box. Filled in by the method. max_out The max x,y,z coordinates of the box. Filled in by the method.
|
inline |
|
inline |
Accessors
Definition at line 321 of file Grid.h.
Referenced by Freestyle::ViewMapBuilder::ComputeRayCastingVisibility().
|
inline |
Definition at line 326 of file Grid.h.
Referenced by Freestyle::ViewMapBuilder::ComputeRayCastingVisibility().
bool Freestyle::Grid::initAcceleratedInfiniteRay | ( | const Vec3r & | orig, |
const Vec3r & | dir, | ||
unsigned | timestamp | ||
) |
void Freestyle::Grid::initAcceleratedRay | ( | const Vec3r & | orig, |
const Vec3r & | end, | ||
unsigned | timestamp | ||
) |
Init all structures and values for computing the cells intersected by this infinite ray. Returns false if the ray doesn't intersect the grid.
Definition at line 344 of file Grid.cpp.
References BLI_assert, blender::math::floor(), Freestyle::BBox< Point >::inside(), Freestyle::GeomUtils::intersectRayBBox(), and Freestyle::VecMat::Vec< T, N >::normalize().
Init all structures and values for computing the cells intersected by this new ray
Definition at line 328 of file Grid.cpp.
References blender::math::floor(), and Freestyle::VecMat::Vec< T, N >::norm().
inserts a convex polygon occluder This method is quite coarse insofar as it adds all cells intersecting the polygon bounding box convex_poly The list of 3D points constituting a convex polygon
Definition at line 140 of file Grid.cpp.
References Freestyle::Cell::addOccluder(), Freestyle::Geometry::Polygon< Point >::getBBox(), Freestyle::Geometry::Polygon< Point >::getVertices(), max, min, Freestyle::firstIntersectionGridVisitor::occluder(), Freestyle::GeomUtils::overlapTriangleBox(), Freestyle::x, y, and z.
Referenced by Freestyle::WFillGrid::fillGrid(), and Freestyle::WSFillGrid::fillGrid().
|
protected |
Definition at line 377 of file Grid.h.
Referenced by Freestyle::FastGrid::configure(), Freestyle::FastGrid::fillCell(), and Freestyle::FastGrid::getCell().
|
protected |