triangular.h 4.29 KB
Newer Older
Lionel Untereiner's avatar
Lionel Untereiner committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
*                                                                              *
* This library is free software; you can redistribute it and/or modify it      *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library is distributed in the hope that it will be useful, but WITHOUT  *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* along with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
* Web site: http://cgogn.unistra.fr/                                           *
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

untereiner's avatar
untereiner committed
25 26
#include "Algo/Tiling/tiling.h"

Lionel Untereiner's avatar
Lionel Untereiner committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#ifndef _TILING_TRIANGULAR_H_
#define _TILING_TRIANGULAR_H_

namespace CGoGN
{

namespace Algo
{

namespace Surface
{

namespace Tilings
{

untereiner's avatar
untereiner committed
42 43 44 45 46
namespace Triangular
{


/*! \brief The class of regular grid square tiling
Lionel Untereiner's avatar
Lionel Untereiner committed
47 48
 */
template <typename PFP>
untereiner's avatar
untereiner committed
49
class Grid : public Tiling<PFP>
Lionel Untereiner's avatar
Lionel Untereiner committed
50 51 52 53 54
{
    typedef typename PFP::MAP MAP;
    typedef typename PFP::VEC3 VEC3;

public:
untereiner's avatar
untereiner committed
55 56 57 58 59 60 61
    Grid(MAP& map, unsigned int x, unsigned int y, bool close):
        Tiling<PFP>(map,x,y,-1)
    {
        grid(x,y,close);
    }

    Grid(MAP& map, unsigned int x, unsigned int y):
62 63 64 65
		Tiling<PFP>(map,x,y,-1)
	{
		grid(x,y,true);
	}
Lionel Untereiner's avatar
Lionel Untereiner committed
66

untereiner's avatar
untereiner committed
67
    /*! @name Embedding Operators
Lionel Untereiner's avatar
Lionel Untereiner committed
68 69 70 71
     * Tiling creation
     *************************************************************************/

    //@{
untereiner's avatar
untereiner committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
    //! Embed a topological grid
    /*! @param position Attribute used to store vertices positions
     *  @param x size in X
     *  @param x size in Y
     *  @param y position in Z (centered on 0 by default)
     */
    void embedIntoGrid(VertexAttribute<VEC3>& position, float x, float y, float z = 0.0f);

    //! Embed a topological grid into a twister open ribbon with turns=PI it is a Moebius strip, needs only to be closed (if model allow it)
    /*! @param position Attribute used to store vertices positions
     *  @param radius_min
     *  @param radius_max
     *  @param turns number of turn multiplied by 2*PI
     */
    void embedIntoTwistedStrip(VertexAttribute<VEC3>& position, float radius_min, float radius_max, float turns);

    //! Embed a topological grid into a helicoid
    /*! @param position Attribute used to store vertices positions
     *  @param radius_min
     *  @param radius_max
     *  @param maxHeight height to reach
     *  @param turns number of turn
Lionel Untereiner's avatar
Lionel Untereiner committed
94
     */
untereiner's avatar
untereiner committed
95
    void embedIntoHelicoid(VertexAttribute<VEC3>& position, float radius_min,  float radius_max, float maxHeight, float nbTurn, int orient = 1);
Lionel Untereiner's avatar
Lionel Untereiner committed
96 97
    //@}

untereiner's avatar
untereiner committed
98 99
protected:
    /*! @name Topological Operators
Lionel Untereiner's avatar
Lionel Untereiner committed
100 101 102 103
     * Tiling creation
     *************************************************************************/

    //@{
untereiner's avatar
untereiner committed
104 105 106 107
    //! Create a 2D grid
    /*! @param x nb of squares in x
     *  @param y nb of squares in y
     *  @param closed close the boundary face of the 2D grid
Lionel Untereiner's avatar
Lionel Untereiner committed
108
     */
untereiner's avatar
untereiner committed
109
    void grid(unsigned int x, unsigned int y, bool close);
Lionel Untereiner's avatar
Lionel Untereiner committed
110
    //@}
untereiner's avatar
untereiner committed
111

Lionel Untereiner's avatar
Lionel Untereiner committed
112 113
};

untereiner's avatar
untereiner committed
114 115
} // namespace Triangular

Lionel Untereiner's avatar
Lionel Untereiner committed
116 117 118 119 120 121 122 123
} // namespace Tilings

} // namespace Surface

} // namespace Algo

} // namespace CGoGN

untereiner's avatar
untereiner committed
124
#include "Algo/Tiling/Surface/triangular.hpp"
Lionel Untereiner's avatar
Lionel Untereiner committed
125 126

#endif //_TILING_TRIANGULAR_H_