Geometrize  1.0
C++ library for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Public Attributes | List of all members
geometrize::State Class Reference

The State class relates a shape and related properties to a measure of how close it brings the working image closer to the target image. More...

#include <state.h>

Public Member Functions

 State ()
 
 State (const std::shared_ptr< geometrize::Shape > &shape, std::uint8_t alpha)
 Creates a new state. More...
 
 ~State ()=default
 
 State (const State &other)
 
Stateoperator= (const State &other)
 
geometrize::State mutate ()
 mutate Modifies the current state in a random fashion. More...
 

Public Attributes

double m_score
 The score of the state, a measure of the improvement applying the state to the current bitmap will have. More...
 
std::uint8_t m_alpha
 The alpha of the shape. More...
 
std::shared_ptr
< geometrize::Shape
m_shape
 The geometric primitive owned by the state. More...
 

Detailed Description

The State class relates a shape and related properties to a measure of how close it brings the working image closer to the target image.

Author
Sam Twidale (https://samcodes.co.uk/)

Constructor & Destructor Documentation

geometrize::State::State ( )
11 : m_score{-1.0}, m_alpha{0}, m_shape{nullptr} {}
std::shared_ptr< geometrize::Shape > m_shape
The geometric primitive owned by the state.
Definition: state.h:43
double m_score
The score of the state, a measure of the improvement applying the state to the current bitmap will ha...
Definition: state.h:41
std::uint8_t m_alpha
The alpha of the shape.
Definition: state.h:42
geometrize::State::State ( const std::shared_ptr< geometrize::Shape > &  shape,
std::uint8_t  alpha 
)

Creates a new state.

Parameters
shapeThe shape.
alphaThe color alpha of the geometric shape.
13  :
14  m_score{-1.0}, m_alpha{alpha}, m_shape{shape}
15 {
16  m_shape->setup(*m_shape);
17 }
std::shared_ptr< geometrize::Shape > m_shape
The geometric primitive owned by the state.
Definition: state.h:43
double m_score
The score of the state, a measure of the improvement applying the state to the current bitmap will ha...
Definition: state.h:41
std::uint8_t m_alpha
The alpha of the shape.
Definition: state.h:42
geometrize::State::~State ( )
default
geometrize::State::State ( const State other)
29  : m_score{other.m_score}, m_alpha{other.m_alpha}, m_shape{other.m_shape->clone()}
30 {
31 }
std::shared_ptr< geometrize::Shape > m_shape
The geometric primitive owned by the state.
Definition: state.h:43
double m_score
The score of the state, a measure of the improvement applying the state to the current bitmap will ha...
Definition: state.h:41
std::uint8_t m_alpha
The alpha of the shape.
Definition: state.h:42

Member Function Documentation

geometrize::State geometrize::State::mutate ( )

mutate Modifies the current state in a random fashion.

Returns
The old state, useful for undoing the mutation or keeping track of previous states.
34 {
35  geometrize::State oldState(*this);
36  m_shape->mutate(*m_shape);
37  m_score = -1;
38  return oldState;
39 }
std::shared_ptr< geometrize::Shape > m_shape
The geometric primitive owned by the state.
Definition: state.h:43
double m_score
The score of the state, a measure of the improvement applying the state to the current bitmap will ha...
Definition: state.h:41
The State class relates a shape and related properties to a measure of how close it brings the workin...
Definition: state.h:20
State & geometrize::State::operator= ( const State other)
20 {
21  if(this != &other) {
22  m_score = other.m_score;
23  m_alpha = other.m_alpha;
24  m_shape = other.m_shape->clone();
25  }
26  return *this;
27 }
std::shared_ptr< geometrize::Shape > m_shape
The geometric primitive owned by the state.
Definition: state.h:43
double m_score
The score of the state, a measure of the improvement applying the state to the current bitmap will ha...
Definition: state.h:41
std::uint8_t m_alpha
The alpha of the shape.
Definition: state.h:42

Member Data Documentation

std::uint8_t geometrize::State::m_alpha

The alpha of the shape.

double geometrize::State::m_score

The score of the state, a measure of the improvement applying the state to the current bitmap will have.

std::shared_ptr<geometrize::Shape> geometrize::State::m_shape

The geometric primitive owned by the state.


The documentation for this class was generated from the following files: