public |
Inheritance Graph
graph BT
VisibilityVector
click VisibilityVector "classMinSG_1_1VisibilitySubdivision_1_1VisibilityVector"
Description
Storage class for the mapping of nodes to their benefits. The benefits are a natural number and can represent the number of visible pixels for example.
Author: Benjamin Eikel
Date: 2009-02-18, benefits and typedefs added 2009-08-18, costs removed from map 2010-01-15
Serialization
void | serialize(std::ostream & out, const SceneManagement::SceneManager & sceneManager) const |
VisibilityVector | unserialize(std::istream & in, const SceneManagement::SceneManager & sceneManager) |
Public Types
typedef GeometryNode * | node_ptr |
typedef uint32_t | costs_t |
typedef uint32_t | benefits_t |
typedef std::pair< node_ptr , benefits_t > | node_benefits_pair_t |
Public Functions
bool | operator==(const VisibilityVector & other) const Equality comparison. |
void | setNode( node_ptr node, benefits_t nodeBenefits) |
void | removeNode( node_ptr node) |
costs_t | getCosts( node_ptr node) const |
benefits_t | getBenefits( node_ptr node) const |
benefits_t | increaseBenefits( node_ptr node, benefits_t benefitsIncr) |
uint32_t | getIndexCount() const |
node_ptr | getNode(uint32_t index) const |
costs_t | getCosts(uint32_t index) const |
benefits_t | getBenefits(uint32_t index) const |
costs_t | getTotalCosts() const |
benefits_t | getTotalBenefits() const |
std::size_t | getVisibleNodeCount() const |
std::string | toString() const |
size_t | getMemoryUsage() const |
Public Static Functions
VisibilityVector | makeMin(const VisibilityVector & vv1, const VisibilityVector & vv2) |
VisibilityVector | makeMax(const VisibilityVector & vv1, const VisibilityVector & vv2) |
VisibilityVector | makeDifference(const VisibilityVector & vv1, const VisibilityVector & vv2) |
VisibilityVector | makeSymmetricDifference(const VisibilityVector & vv1, const VisibilityVector & vv2) |
VisibilityVector | makeWeightedThree(float w1, const VisibilityVector & vv1, float w2, const VisibilityVector & vv2, float w3, const VisibilityVector & vv3) |
void | diff(const VisibilityVector & vv1, const VisibilityVector & vv2, costs_t & costsDiff, benefits_t & benefitsDiff, std::size_t & sameCount) |
Documentation
function
MinSG::VisibilitySubdivision::VisibilityVector::serialize
public | const |
void serialize( | std::ostream & | out, |
const SceneManagement::SceneManager & | sceneManager | |
) const |
Write a visibility vector to a stream.
Parameters
- out
- Output stream
- sceneManager
- Reference to the scene manager that is needed to look up registered nodes
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:249
function
MinSG::VisibilitySubdivision::VisibilityVector::unserialize
public | static |
VisibilityVector unserialize( | std::istream & | in, |
const SceneManagement::SceneManager & | sceneManager | |
) |
Read a visibility vector from a stream.
Parameters
- in
- Input stream
- sceneManager
- Reference to the scene manager that is needed to look up registered nodes
Returns
New visibility vector
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:260
typedef
MinSG::VisibilitySubdivision::VisibilityVector::node_ptr
public |
typedef GeometryNode * node_ptr |
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:42
typedef
MinSG::VisibilitySubdivision::VisibilityVector::costs_t
public |
typedef uint32_t costs_t |
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:43
typedef
MinSG::VisibilitySubdivision::VisibilityVector::benefits_t
public |
typedef uint32_t benefits_t |
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:44
typedef
MinSG::VisibilitySubdivision::VisibilityVector::node_benefits_pair_t
public |
typedef std::pair< node_ptr , benefits_t > node_benefits_pair_t |
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:45
function
MinSG::VisibilitySubdivision::VisibilityVector::operator==
public | const |
bool operator==( | const VisibilityVector & | other ) const |
Equality comparison.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:48
function
MinSG::VisibilitySubdivision::VisibilityVector::setNode
public |
void setNode( | node_ptr | node, |
benefits_t | nodeBenefits | |
) |
Set the benefits of one node. If the node was already added before, the data will be updated.
Parameters
- node
- Pointer to the node.
- nodeBenefits
- Benefits of the node.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:57
function
MinSG::VisibilitySubdivision::VisibilityVector::removeNode
public |
void removeNode( | node_ptr | node ) |
Remove a node from the vector
Parameters
- node
- Pointer to the node.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:64
function
MinSG::VisibilitySubdivision::VisibilityVector::getCosts
public | const |
costs_t getCosts( | node_ptr | node ) const |
Get the costs of one node.
Parameters
- node
- Pointer to the node.
Returns
Costs of the node, or 0 if the node is not stored here.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:72
function
MinSG::VisibilitySubdivision::VisibilityVector::getBenefits
public | const |
benefits_t getBenefits( | node_ptr | node ) const |
Get the benefits of one node.
Parameters
- node
- Pointer to the node.
Returns
Benefits of the node, or 0 if the node is not stored here.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:80
function
MinSG::VisibilitySubdivision::VisibilityVector::increaseBenefits
public |
benefits_t increaseBenefits( | node_ptr | node, |
benefits_t | benefitsIncr | |
) |
Increase the benefits of a node. If the node has not been stored here before, add the node with the given benefits.
The result is equivalent to the following:
benefits_t oldBenefits = vv.getBenefits(node);
vv.setNode(node, oldBenefits + benefitsIncr);
Parameters
- node
- Pointer to the node
- benefitsIncr
- Amount that the benefits of the node is increased
Returns
The benefits of the node before the increase, or zero if the node has not been stored here before.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:97
function
MinSG::VisibilitySubdivision::VisibilityVector::getIndexCount
public | const |
uint32_t getIndexCount( | ) const |
Return the number of indices for the data stored here. This value is useful when iteratively accessing the data stored here.
Returns
Number of indices
Note: This is number is one larger than what is allowed as parameter ingetNode(uint32_t),getCosts(uint32_t), orgetBenefits(uint32_t).
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:107
function
MinSG::VisibilitySubdivision::VisibilityVector::getNode
public | const |
node_ptr getNode( | uint32_t | index ) const |
Get a node.
Parameters
- index
- Index of the node from [0,getIndexCount)
Returns
Pointer to the node, ornullptr
if the index is invalid.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:115
function
MinSG::VisibilitySubdivision::VisibilityVector::getCosts
public | const |
costs_t getCosts( | uint32_t | index ) const |
Get the costs of one node.
Parameters
- index
- Index of the node from [0,getIndexCount)
Returns
Costs of the node, or 0 if the index is invalid.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:123
function
MinSG::VisibilitySubdivision::VisibilityVector::getBenefits
public | const |
benefits_t getBenefits( | uint32_t | index ) const |
Get the benefits of one node.
Parameters
- index
- Index of the node from [0,getIndexCount)
Returns
Benefits of the node, or 0 if the index is invalid.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:131
function
MinSG::VisibilitySubdivision::VisibilityVector::getTotalCosts
public | const |
costs_t getTotalCosts( | ) const |
Get the sum of all costs stored in this vector.
Returns
Overall costs.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:138
function
MinSG::VisibilitySubdivision::VisibilityVector::getTotalBenefits
public | const |
benefits_t getTotalBenefits( | ) const |
Get the sum of all costs stored in this vector.
Returns
Overall costs.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:145
function
MinSG::VisibilitySubdivision::VisibilityVector::getVisibleNodeCount
public | const |
std::size_t getVisibleNodeCount( | ) const |
Return the number of nodes stored in this vector.
Returns
Number of nodes
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:152
function
MinSG::VisibilitySubdivision::VisibilityVector::toString
public | const |
std::string toString( | ) const |
Return a human-readable representation.
Returns
Textual representation of this object.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:229
function
MinSG::VisibilitySubdivision::VisibilityVector::getMemoryUsage
public | const |
size_t getMemoryUsage( | ) const |
Calculate the amount of memory that is required to store the visibility vector.
Returns
Overall amount of memory in bytes
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:237
function
MinSG::VisibilitySubdivision::VisibilityVector::makeMin
public | static |
VisibilityVector makeMin( | const VisibilityVector & | vv1, |
const VisibilityVector & | vv2 | |
) |
Return a minimal visibility vector calculated from the values of two visibility vectors. Only if an object exists in both of them, the minimal costs and benefits of this object from both vectors are returned.
Parameters
- vv1
- First visibility vector.
- vv2
- Second visibility vector.
Returns
Visibility vector containing the minimal vector.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:162
function
MinSG::VisibilitySubdivision::VisibilityVector::makeMax
public | static |
VisibilityVector makeMax( | const VisibilityVector & | vv1, |
const VisibilityVector & | vv2 | |
) |
Return a maximal visibility vector calculated from the values of two visibility vectors. If an object exists in one of them, the maximal costs and benefits of this object from both vectors are returned.
Parameters
- vv1
- First visibility vector.
- vv2
- Second visibility vector.
Returns
Visibility vector containing the maximal vector.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:172
function
MinSG::VisibilitySubdivision::VisibilityVector::makeDifference
public | static |
VisibilityVector makeDifference( | const VisibilityVector & | vv1, |
const VisibilityVector & | vv2 | |
) |
Return a difference visibility vector calculated from the values of two visibility vectors. The difference contains the values that are in the first visibility vector but not in the second.
Parameters
- vv1
- First visibility vector.
- vv2
- Second visibility vector.
Returns
Visibility vector containing the difference vector.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:182
function
MinSG::VisibilitySubdivision::VisibilityVector::makeSymmetricDifference
public | static |
VisibilityVector makeSymmetricDifference( | const VisibilityVector & | vv1, |
const VisibilityVector & | vv2 | |
) |
Return a symmetric difference visibility vector calculated from the values of two visibility vectors. The symmetric difference contains the values that are in either of the visibility vectors and not in both.
Parameters
- vv1
- First visibility vector.
- vv2
- Second visibility vector.
Returns
Visibility vector containing the symmetric difference vector.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:192
function
MinSG::VisibilitySubdivision::VisibilityVector::makeWeightedThree
public | static |
VisibilityVector makeWeightedThree( | float | w1, |
const VisibilityVector & | vv1, | |
float | w2, | |
const VisibilityVector & | vv2, | |
float | w3, | |
const VisibilityVector & | vv3 | |
) |
Return a visibility vector calculated from the values of three visibility vectors. If an entry is contained in a visibility vector, it is weighted with the given weight for that visibility vector. If an entry is not contained in a visibility vector, it is weighted with zero for that visibility vector. The resulting benefits for that entry will be the weighted sum of the three benefits.
Parameters
- w1
- Weight for the objects of the first visibility vector.
- vv1
- First visibility vector.
- w2
- Weight for the objects of the second visibility vector.
- vv2
- Second visibility vector.
- w3
- Weight for the objects of the third visibility vector.
- vv3
- Third visibility vector.
- result
- Visibility vector containing the weighted visibility vector.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:208
function
MinSG::VisibilitySubdivision::VisibilityVector::diff
public | static |
void diff( | const VisibilityVector & | vv1, |
const VisibilityVector & | vv2, | |
costs_t & | costsDiff, | |
benefits_t & | benefitsDiff, | |
std::size_t & | sameCount | |
) |
Return the difference in costs and benefits between two visibility vectors.
Parameters
- vv1
- First visibility vector.
- vv2
- Second visibility vector.
- costsDiff
- Difference in costs.
- benefitsDiff
- Difference in benefits.
- sameCount
- Number of entries pointing to the same object.
Defined in MinSG/Ext/VisibilitySubdivision/VisibilityVector.h:221