bWidgets
Core widget toolkit designed for Blender
bwPolygon.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <vector>
4
5
namespace
bWidgets
{
6
7
/* TODO for (2D-)polygons, we should actually use ints, not floats. Prevents precision and rounding
8
* errors. */
9
using
bwPointVec
= std::vector<class bwPoint>;
10
11
class
bwPolygon
{
12
public
:
13
bwPolygon
() =
default
;
14
bwPolygon
(
const
bwPolygon
& poly) =
default
;
15
bwPolygon
(
const
bwPointVec
&
vertices
);
16
explicit
bwPolygon
(
const
unsigned
int
reserve_vertex_count);
17
18
void
addVertex
(
class
bwPoint
vertex);
19
void
addVertex
(
const
float
x,
const
float
y);
20
void
addVertex
(
const
int
x,
const
int
y);
21
void
reserve
(
const
unsigned
int
count);
22
auto
getVertices
() const -> const
bwPointVec
&;
23
24
auto operator[](const
unsigned
int
index) ->
bwPoint
&;
25
26
auto
isDrawable
() const ->
bool
;
27
28
protected:
29
bwPointVec
vertices
{};
30
size_t
vert_count
{0};
31
};
32
33
}
// namespace bWidgets
bWidgets::bwPoint
Definition:
bwPoint.h:7
bWidgets::bwPolygon
Definition:
bwPolygon.h:11
bWidgets::bwPolygon::getVertices
auto getVertices() const -> const bwPointVec &
Definition:
bwPolygon.cc:40
bWidgets::bwPolygon::bwPolygon
bwPolygon()=default
bWidgets::bwPolygon::addVertex
void addVertex(class bwPoint vertex)
Definition:
bwPolygon.cc:19
bWidgets::bwPolygon::reserve
void reserve(const unsigned int count)
Definition:
bwPolygon.cc:35
bWidgets::bwPolygon::vert_count
size_t vert_count
Definition:
bwPolygon.h:30
bWidgets::bwPolygon::vertices
bwPointVec vertices
Definition:
bwPolygon.h:29
bWidgets::bwPolygon::bwPolygon
bwPolygon(const bwPolygon &poly)=default
bWidgets::bwPolygon::isDrawable
auto isDrawable() const -> bool
Definition:
bwPolygon.cc:50
bWidgets
Definition:
bwContext.h:3
bWidgets::bwPointVec
std::vector< class bwPoint > bwPointVec
Definition:
bwPolygon.h:9
bwidgets
generics
bwPolygon.h
Generated by
1.9.3