26 const double TriangularTile::g_side_length = 10.0;
27 const double TriangularTile::g_height = std::sqrt(3.0) / 2 * g_side_length;
28 const QPolygonF TriangularTile::g_start_polygon(QPolygonF() << QPointF(0, 0) << QPointF(g_side_length / 2, g_height) << QPointF(g_side_length, 0));
32 QPainterPath PolygonToPath(
const QPolygonF &polygon,
bool odd)
36 path.moveTo(polygon.last());
37 path.lineTo(polygon.at(0));
38 path.lineTo(polygon.at(1));
40 path.moveTo(polygon.first());
41 path.lineTo(polygon.at(1));
49 :
Tile(g_start_polygon, PolygonToPath(g_start_polygon, false)), m_odd(false)
51 setParentItem(
nullptr);
55 :
Tile(polygon, PolygonToPath(polygon, odd)), m_odd(odd)
57 setParentItem(parentItem);
66 QPolygonF polygon(m_polygon);
68 polygon.push_front(polygon.back() - QPointF(g_side_length, 0));
74 QPolygonF polygon(m_polygon);
76 polygon.push_back(polygon.front() + QPointF(g_side_length, 0));
82 QPolygonF polygon(m_polygon);
84 polygon[1] = polygon[1] - QPointF(0, 2 * g_height);
86 polygon[0] = polygon[0] - QPointF(0, 2 * g_height);
87 polygon[2] = polygon[2] - QPointF(0, 2 * g_height);
94 QPolygonF polygon(m_polygon);
96 polygon[0] = polygon[0] + QPointF(0, 2 * g_height);
97 polygon[2] = polygon[2] + QPointF(0, 2 * g_height);
99 polygon[1] = polygon[1] + QPointF(0, 2 * g_height);
TriangularTile()
Constructor.
virtual TriangularTile * Left() const
Creates a new tile to the left of this tile (should normally be the opposite of Tile::Right()) Parent...
virtual TriangularTile * Up() const
Creates a new tile on the row under this tile (should normally be the opposite of Tile::Down()) Paren...
Namespace for SimPT tissue editor package.
Interface for TriangularTile.
virtual ~TriangularTile()
Destructor.
virtual TriangularTile * Down() const
Creates a new tile on the row under this tile (should normally be the opposite of Tile::Up()) Parent ...
Abstract base class for cell pattern tiles.
virtual TriangularTile * Right() const
Creates a new tile to the right of this tile (should normally be the opposite of Tile::Left()) Parent...
see the online Qt documentation