Environnement used to symmetrise zones. More...
#include <zone_symmetrisation.h>
Classes | |
| class | CError |
| Error structure. More... | |
Public Types | |
| enum | TState { Nothing = 0, Regular = 1, Goofy = 2 } |
Symmetrie state. More... | |
Public Member Functions | |
| CZoneSymmetrisation () | |
| Constructor. | |
| TState | getTileState (uint patch, uint tile, uint layer) const |
| Get tile symmetry state Can return Regular, Goofy or Nothing. | |
| TState | getTileBorderState (uint patch, uint tile) const |
| Get tile symmetry state Can return Regular, Goofy or Nothing. | |
| TState | getOrientedTileBorderState (uint patch, uint tile) const |
| Get tile symmetry state for oriented tiles Can return Regular, Goofy or Nothing. | |
| bool | getOrientedTileCorner (uint patch, uint tile) |
| Set oriented tile corner state. | |
| bool | build (const std::vector< CPatchInfo > &patchInfo, float snapCell, float weldThreshold, const CTileBank &bank, CError &errorDesc, const NLMISC::CMatrix &toOriginalSpace) |
| Build symmetry informations. | |
Private Member Functions | |
| bool | propagateTileState (uint i, uint s, uint t, const std::vector< CPatchInfo > &patchInfo, const CTileBank &bank, bool forceRegular) |
| Propagate tile state information for a given tile. | |
| void | setTileState (uint patch, uint tile, uint layer, TState state) |
| Set orientedtile symmetry state. | |
| void | setTileBorderState (uint patch, uint tile, TState state) |
| Set border tile symmetry state. | |
| void | setOrientedTileBorderState (uint patch, uint tile, TState state) |
| Set border oriented tile symmetry state. | |
| void | setOrientedTileCorner (uint patch, uint tile, bool corner) |
| Set oriented tile corner state. | |
| bool | setTileState (const NL3D::CPatchInfo &patch, uint patchId, float snapCell, float weldThreshold, TState &state, const NLMISC::CMatrix &toOriginalSpace, const CTileBank &bank) |
| Set tile state of a patch. | |
| bool | setOrientedTileState (const NL3D::CPatchInfo &patch, uint patchId, float snapCell, float weldThreshold, TState &state, const NLMISC::CMatrix &toOriginalSpace, const CTileBank &bank) |
Static Private Member Functions | |
| static bool | snapOnGrid (float &value, float resolution, float snap) |
Private Attributes | |
| std::vector< std::vector < uint16 > > | _TilesLayerStates |
Environnement used to symmetrise zones.
This class build symmetry specific informations needed to know how transform tiles when a zone is symmetrise.
There is two states for a tile : Regular or Goofy. If the tile is regular, it doesn't need specific transformation when the zone is symmetrise. If the tile is goofy, the tile must be rotate by 180deg more to be correct.
Definition at line 52 of file zone_symmetrisation.h.
Symmetrie state.
Definition at line 57 of file zone_symmetrisation.h.
| NL3D::CZoneSymmetrisation::CZoneSymmetrisation | ( | ) |
Constructor.
Definition at line 37 of file zone_symmetrisation.cpp.
| bool NL3D::CZoneSymmetrisation::build | ( | const std::vector< CPatchInfo > & | patchInfo, | |
| float | snapCell, | |||
| float | weldThreshold, | |||
| const CTileBank & | bank, | |||
| CError & | errorDesc, | |||
| const NLMISC::CMatrix & | toOriginalSpace | |||
| ) |
Build symmetry informations.
| zone | is the zone to build symmetry informations | |
| snapCell | is the unit size of the zones | |
| weldThreshold | is the threshold used to check vertex over snaped positions | |
| errorDesc | is a structure used to return errors | |
| toOriginalSpace | is the matrix used to transform back a vertex in its original position before symmetry / rotation |
Definition at line 184 of file zone_symmetrisation.cpp.
References _TilesLayerStates, NL3D::CZoneSymmetrisation::CError::Errors, NL3D::CPatchInfo::OrderS, NL3D::CPatchInfo::OrderT, propagateTileState(), setOrientedTileState(), setTileState(), and NLMISC::toString().
Referenced by NL3D::CPatchInfo::transform().
| CZoneSymmetrisation::TState NL3D::CZoneSymmetrisation::getOrientedTileBorderState | ( | uint | patch, | |
| uint | tile | |||
| ) | const |
Get tile symmetry state for oriented tiles Can return Regular, Goofy or Nothing.
Definition at line 70 of file zone_symmetrisation.cpp.
References getTileState().
Set oriented tile corner state.
Definition at line 77 of file zone_symmetrisation.cpp.
References _TilesLayerStates.
Referenced by propagateTileState().
| CZoneSymmetrisation::TState NL3D::CZoneSymmetrisation::getTileBorderState | ( | uint | patch, | |
| uint | tile | |||
| ) | const |
Get tile symmetry state Can return Regular, Goofy or Nothing.
Definition at line 63 of file zone_symmetrisation.cpp.
References getTileState().
| CZoneSymmetrisation::TState NL3D::CZoneSymmetrisation::getTileState | ( | uint | patch, | |
| uint | tile, | |||
| uint | layer | |||
| ) | const |
Get tile symmetry state Can return Regular, Goofy or Nothing.
Definition at line 55 of file zone_symmetrisation.cpp.
References _TilesLayerStates, and nlassert.
Referenced by getOrientedTileBorderState(), getTileBorderState(), propagateTileState(), and NL3D::CPatchInfo::transform().
| bool NL3D::CZoneSymmetrisation::propagateTileState | ( | uint | i, | |
| uint | s, | |||
| uint | t, | |||
| const std::vector< CPatchInfo > & | patchInfo, | |||
| const CTileBank & | bank, | |||
| bool | forceRegular | |||
| ) | [private] |
Propagate tile state information for a given tile.
| i | is the patch number in the zone that contain the tile to propagate | |
| u | is the tile u coordinate in the patch | |
| v | is the tile v coordinate in the patch | |
| patchInfo | is a vector of patch information | |
| bank | is the tile bank used by the landscape | |
| forceRegular | must be true to force the first propagated tile to Regular if Nothing |
Definition at line 676 of file zone_symmetrisation.cpp.
References NL3D::CFillStackNode::Edge, NL3D::CPatchInfo::CBindInfo::Edge, NL3D::CTileSet::getOriented(), getOrientedTileCorner(), NL3D::CTileBank::getTileCount(), NL3D::CTileBank::getTileSet(), NL3D::CTileBank::getTileSetCount(), getTileState(), NL3D::CTileBank::getTileXRef(), Goofy, NL3D::CPatchInfo::CBindInfo::Next, NL_TILE_ELM_LAYER_EMPTY, nlassert, nlwarning, Nothing, NL3D::CPatchInfo::CBindInfo::NPatchs, NL3D::CPatchInfo::OrderS, NL3D::CFillStackNode::Patch, Regular, NL3D::CFillStackNode::Rotate, NL3D::CFillStackNode::S, setTileState(), NL3D::CFillStackNode::State, NL3D::CFillStackNode::T, and NL3D::CPatchInfo::Tiles.
Referenced by build().
| void NL3D::CZoneSymmetrisation::setOrientedTileBorderState | ( | uint | patch, | |
| uint | tile, | |||
| TState | state | |||
| ) | [private] |
Set border oriented tile symmetry state.
Definition at line 100 of file zone_symmetrisation.cpp.
References setTileState().
Referenced by setOrientedTileState().
| void NL3D::CZoneSymmetrisation::setOrientedTileCorner | ( | uint | patch, | |
| uint | tile, | |||
| bool | corner | |||
| ) | [private] |
Set oriented tile corner state.
Definition at line 107 of file zone_symmetrisation.cpp.
References _TilesLayerStates.
Referenced by setOrientedTileState().
| bool NL3D::CZoneSymmetrisation::setOrientedTileState | ( | const NL3D::CPatchInfo & | patch, | |
| uint | patchId, | |||
| float | snapCell, | |||
| float | weldThreshold, | |||
| TState & | state, | |||
| const NLMISC::CMatrix & | toOriginalSpace, | |||
| const CTileBank & | bank | |||
| ) | [private] |
Definition at line 474 of file zone_symmetrisation.cpp.
References NL3D::CTileSet::getOriented(), NL3D::CTileBank::getTileSet(), NL3D::CTileBank::getTileSetCount(), NL3D::CTileBank::getTileXRef(), Goofy, NL_TILE_ELM_LAYER_EMPTY, nlwarning, Nothing, NL3D::CPatchInfo::OrderS, NL3D::CPatchInfo::OrderT, NL3D::CPatchInfo::Patch, Regular, setOrientedTileBorderState(), setOrientedTileCorner(), setTileState(), snapOnGrid(), NL3D::CPatchInfo::Tiles, NL3D::CBezierPatch::Vertices, NLMISC::CVector::x, and NLMISC::CVector::y.
Referenced by build().
| void NL3D::CZoneSymmetrisation::setTileBorderState | ( | uint | patch, | |
| uint | tile, | |||
| TState | state | |||
| ) | [private] |
Set border tile symmetry state.
Definition at line 93 of file zone_symmetrisation.cpp.
References setTileState().
Referenced by setTileState().
| bool NL3D::CZoneSymmetrisation::setTileState | ( | const NL3D::CPatchInfo & | patch, | |
| uint | patchId, | |||
| float | snapCell, | |||
| float | weldThreshold, | |||
| TState & | state, | |||
| const NLMISC::CMatrix & | toOriginalSpace, | |||
| const CTileBank & | bank | |||
| ) | [private] |
Set tile state of a patch.
Definition at line 310 of file zone_symmetrisation.cpp.
References NL3D::CTileSet::getOriented(), NL3D::CTileBank::getTileSet(), NL3D::CTileBank::getTileSetCount(), NL3D::CTileBank::getTileXRef(), Goofy, NL_TILE_ELM_LAYER_EMPTY, nlwarning, Nothing, NL3D::CPatchInfo::OrderS, NL3D::CPatchInfo::OrderT, NL3D::CPatchInfo::Patch, Regular, setTileBorderState(), setTileState(), snapOnGrid(), NL3D::CPatchInfo::Tiles, NL3D::CBezierPatch::Vertices, NLMISC::CVector::x, and NLMISC::CVector::y.
| void NL3D::CZoneSymmetrisation::setTileState | ( | uint | patch, | |
| uint | tile, | |||
| uint | layer, | |||
| TState | state | |||
| ) | [private] |
Set orientedtile symmetry state.
Definition at line 84 of file zone_symmetrisation.cpp.
References _TilesLayerStates.
Referenced by build(), propagateTileState(), setOrientedTileBorderState(), setOrientedTileState(), setTileBorderState(), and setTileState().
| bool NL3D::CZoneSymmetrisation::snapOnGrid | ( | float & | value, | |
| float | resolution, | |||
| float | snap | |||
| ) | [static, private] |
Definition at line 278 of file zone_symmetrisation.cpp.
References nlassert.
Referenced by setOrientedTileState(), and setTileState().
std::vector<std::vector<uint16> > NL3D::CZoneSymmetrisation::_TilesLayerStates [private] |
Definition at line 156 of file zone_symmetrisation.h.
Referenced by build(), getOrientedTileCorner(), getTileState(), setOrientedTileCorner(), and setTileState().
1.6.1