|
Blender V5.0
|
#include <Grid.h>
Inherited by Freestyle::FastGrid, and Freestyle::HashGrid.
Public Member Functions | |
| Grid () | |
| virtual | ~Grid () |
| virtual void | clear () |
| virtual void | configure (const Vec3r &orig, const Vec3r &size, uint 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, uint timestamp) |
| void | initAcceleratedRay (const Vec3r &orig, const Vec3r &end, uint timestamp) |
| void | castInfiniteRay (const Vec3r &orig, const Vec3r &dir, OccludersSet &occluders, uint timestamp) |
| bool | initAcceleratedInfiniteRay (const Vec3r &orig, const Vec3r &dir, uint timestamp) |
| Polygon3r * | castRayToFindFirstIntersection (const Vec3r &orig, const Vec3r &dir, double &t, double &u, double &v, uint timestamp) |
| void | initRay (const Vec3r &orig, const Vec3r &end, uint timestamp) |
| bool | initInfiniteRay (const Vec3r &orig, const Vec3r &dir, uint 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 | |
| uint | _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()
Definition at line 164 of file Grid.h.
Referenced by Freestyle::FastGrid::FastGrid(), and Freestyle::HashGrid::HashGrid().
|
inlinevirtual |
|
inline |
Adds an occluder to the list of occluders
Definition at line 261 of file Grid.h.
References _occluders.
Referenced by insertOccluder().
| void Freestyle::Grid::castInfiniteRay | ( | const Vec3r & | orig, |
| const Vec3r & | dir, | ||
| OccludersSet & | occluders, | ||
| uint | 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 295 of file Grid.cpp.
References castRayInternal(), FLT_MAX, initInfiniteRay(), and Freestyle::VecMat::Vec< T, N >::norm().
Referenced by Freestyle::ViewMapBuilder::FindOccludee().
| void Freestyle::Grid::castRay | ( | const Vec3r & | orig, |
| const Vec3r & | end, | ||
| OccludersSet & | occluders, | ||
| uint | 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 288 of file Grid.cpp.
References castRayInternal(), and initRay().
Referenced by Freestyle::ViewMapBuilder::ComputeRayCastingVisibility().
|
inlineprotected |
Core of castRay and castInfiniteRay, find occluders along the given ray
Definition at line 334 of file Grid.h.
References _current_cell, _timestamp, Freestyle::GridVisitor::discoverCell(), Freestyle::GridVisitor::examineOccluder(), Freestyle::GridVisitor::finishCell(), getCell(), Freestyle::Cell::getOccluders(), nextRayCell(), POINTER_AS_UINT, POINTER_FROM_UINT, and Freestyle::GridVisitor::stop().
Referenced by castInfiniteRay(), castRay(), and castRayToFindFirstIntersection().
| Polygon3r * Freestyle::Grid::castRayToFindFirstIntersection | ( | const Vec3r & | orig, |
| const Vec3r & | dir, | ||
| double & | t, | ||
| double & | u, | ||
| double & | v, | ||
| uint | 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 309 of file Grid.cpp.
References _cell_size, castRayInternal(), FLT_MAX, initInfiniteRay(), Freestyle::VecMat::Vec< T, N >::norm(), Freestyle::firstIntersectionGridVisitor::occluder(), Freestyle::firstIntersectionGridVisitor::t_, Freestyle::firstIntersectionGridVisitor::u_, v, and Freestyle::firstIntersectionGridVisitor::v_.
|
virtual |
clears the grid Deletes all the cells, clears the hash-table, resets size, size of cell, number of cells.
Reimplemented in Freestyle::FastGrid, and Freestyle::HashGrid.
Definition at line 85 of file Grid.cpp.
References _cell_size, _cells_nb, _occluders, _orig, and _size.
Referenced by Freestyle::FastGrid::clear(), Freestyle::HashGrid::clear(), and ~Grid().
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::FastGrid, and Freestyle::HashGrid.
Definition at line 101 of file Grid.cpp.
References _cell_size, _cells_nb, _orig, _size, floor, i, min, pow, and size().
Referenced by Freestyle::FastGrid::configure(), and Freestyle::HashGrid::configure().
|
inline |
Definition at line 324 of file Grid.h.
References _cell_size, _cells_nb, _occluders, and _orig.
Fills the case corresponding to coord with the cell
Implemented in Freestyle::FastGrid, and Freestyle::HashGrid.
Referenced by insertOccluder().
returns the cell containing the point passed as argument. If the cell is empty (contains no occluder), nullptr is returned: p The point for which we're looking the cell
Definition at line 219 of file Grid.h.
References getCell(), and getCellCoordinates().
returns the cell whose coordinates are passed as argument
Implemented in Freestyle::FastGrid, and Freestyle::HashGrid.
Referenced by castRayInternal(), getCell(), and insertOccluder().
|
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.
Definition at line 248 of file Grid.h.
References _cell_size, and getCellOrigin().
Referenced by insertOccluder().
returns a vector of integer containing the coordinates of the cell containing the point passed as argument p The point for which we're looking the cell
Definition at line 191 of file Grid.h.
References _cell_size, _cells_nb, _orig, and i.
Referenced by getCell(), and insertOccluder().
Retrieves the x,y,z coordinates of the origin of the cell whose coordinates (i,j,k) is passed as argument: cell_coord i,j,k integer coordinates for the cell orig x,y,x vector to be filled in with the cell origin's coordinates
Definition at line 233 of file Grid.h.
References _cell_size, _orig, and i.
Referenced by getCellBox(), and insertOccluder().
|
inline |
Definition at line 313 of file Grid.h.
References _cell_size.
|
inline |
Definition at line 319 of file Grid.h.
References _occluders.
|
inline |
Accessors
Definition at line 303 of file Grid.h.
References _orig.
Referenced by Freestyle::ViewMapBuilder::ComputeRayCastingVisibility().
|
inline |
Definition at line 308 of file Grid.h.
References _size.
Referenced by Freestyle::ViewMapBuilder::ComputeRayCastingVisibility().
| bool Freestyle::Grid::initAcceleratedInfiniteRay | ( | const Vec3r & | orig, |
| const Vec3r & | dir, | ||
| uint | timestamp ) |
References v.
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 346 of file Grid.cpp.
References _cell_size, _cells_nb, _current_cell, _orig, _pt, _ray_dir, _size, _t, _t_end, _timestamp, BLI_assert, floor, FLT_MAX, i, Freestyle::BBox< Point >::inside(), and Freestyle::GeomUtils::intersectRayBBox().
Referenced by castInfiniteRay(), and castRayToFindFirstIntersection().
Init all structures and values for computing the cells intersected by this new ray
Definition at line 330 of file Grid.cpp.
References _cell_size, _current_cell, _orig, _pt, _ray_dir, _t, _t_end, _timestamp, floor, and i.
Referenced by castRay().
| void Freestyle::Grid::insertOccluder | ( | Polygon3r * | occluder | ) |
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 145 of file Grid.cpp.
References _cell_size, Freestyle::Cell::addOccluder(), addOccluder(), fillCell(), Freestyle::Geometry::Polygon< Point >::getBBox(), getCell(), getCellBox(), getCellCoordinates(), getCellOrigin(), Freestyle::Geometry::Polygon< Point >::getVertices(), i, max, min, Freestyle::GeomUtils::overlapTriangleBox(), Freestyle::x, y, and z().
|
protected |
Definition at line 360 of file Grid.h.
Referenced by castRayToFindFirstIntersection(), clear(), configure(), displayDebug(), getCellBox(), getCellCoordinates(), getCellOrigin(), getCellSize(), initInfiniteRay(), initRay(), insertOccluder(), and nextRayCell().
|
protected |
Definition at line 359 of file Grid.h.
Referenced by clear(), Freestyle::FastGrid::configure(), configure(), displayDebug(), Freestyle::FastGrid::fillCell(), Freestyle::FastGrid::getCell(), getCellCoordinates(), initInfiniteRay(), and nextRayCell().
|
protected |
Definition at line 365 of file Grid.h.
Referenced by castRayInternal(), initInfiniteRay(), and initRay().
|
protected |
Definition at line 373 of file Grid.h.
Referenced by addOccluder(), clear(), displayDebug(), and getOccluders().
|
protected |
Definition at line 362 of file Grid.h.
Referenced by clear(), configure(), displayDebug(), getCellCoordinates(), getCellOrigin(), getOrigin(), initInfiniteRay(), and initRay().
|
protected |
Definition at line 366 of file Grid.h.
Referenced by initInfiniteRay(), initRay(), and nextRayCell().
|
protected |
Definition at line 364 of file Grid.h.
Referenced by initInfiniteRay(), initRay(), and nextRayCell().
|
protected |
Definition at line 361 of file Grid.h.
Referenced by clear(), configure(), gridSize(), and initInfiniteRay().
|
protected |
Definition at line 369 of file Grid.h.
Referenced by initInfiniteRay(), initRay(), and nextRayCell().
|
protected |
Definition at line 368 of file Grid.h.
Referenced by initInfiniteRay(), initRay(), and nextRayCell().
|
protected |
Definition at line 357 of file Grid.h.
Referenced by castRayInternal(), initInfiniteRay(), and initRay().