Geometrize 1.0
C++ library for geometrizing images into geometric primitives
Public Member Functions | Public Attributes | List of all members
geometrize::Rectangle Class Reference

The Rectangle class represents a rectangle. More...

#include <rectangle.h>

Inheritance diagram for geometrize::Rectangle:
Inheritance graph
[legend]
Collaboration diagram for geometrize::Rectangle:
Collaboration graph
[legend]

Public Member Functions

 Rectangle ()=default
 
 Rectangle (float x1, float y1, float x2, float y2)
 
virtual std::shared_ptr< geometrize::Shapeclone () const override
 clone Clones the shape, a virtual copy constructor. More...
 
virtual geometrize::ShapeTypes getType () const override
 getType Gets the ShapeType of the shape. More...
 
- Public Member Functions inherited from geometrize::Shape
 Shape ()=default
 
virtual ~Shape ()=default
 
Shapeoperator= (const geometrize::Shape &other)=default
 
 Shape (const geometrize::Shape &other)=default
 
virtual std::shared_ptr< geometrize::Shapeclone () const
 clone Clones the shape, a virtual copy constructor. More...
 
virtual geometrize::ShapeTypes getType () const
 getType Gets the ShapeType of the shape. More...
 

Public Attributes

float m_x1
 Left coordinate. More...
 
float m_y1
 Top coordinate. More...
 
float m_x2
 Right coordinate. More...
 
float m_y2
 Bottom coordinate. More...
 
- Public Attributes inherited from geometrize::Shape
std::function< void(geometrize::Shape &)> setup
 
std::function< void(geometrize::Shape &)> mutate
 
std::function< std::vector< geometrize::Scanline >(const geometrize::Shape &)> rasterize
 

Detailed Description

The Rectangle class represents a rectangle.

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

Constructor & Destructor Documentation

◆ Rectangle() [1/2]

geometrize::Rectangle::Rectangle ( )
default

◆ Rectangle() [2/2]

geometrize::Rectangle::Rectangle ( float  x1,
float  y1,
float  x2,
float  y2 
)
11 : Shape()
12{
13 m_x1 = x1;
14 m_y1 = y1;
15 m_x2 = x2;
16 m_y2 = y2;
17}
float m_y1
Top coordinate.
Definition: rectangle.h:25
float m_x2
Right coordinate.
Definition: rectangle.h:26
float m_y2
Bottom coordinate.
Definition: rectangle.h:27
float m_x1
Left coordinate.
Definition: rectangle.h:24

Member Function Documentation

◆ clone()

std::shared_ptr< geometrize::Shape > geometrize::Rectangle::clone ( ) const
overridevirtual

clone Clones the shape, a virtual copy constructor.

Returns
A clone of the shape.

Reimplemented from geometrize::Shape.

20{
21 std::shared_ptr<geometrize::Rectangle> rect{std::make_shared<geometrize::Rectangle>()};
22 rect->m_x1 = m_x1;
23 rect->m_y1 = m_y1;
24 rect->m_x2 = m_x2;
25 rect->m_y2 = m_y2;
26 rect->setup = setup;
27 rect->mutate = mutate;
28 rect->rasterize = rasterize;
29 return rect;
30}
std::function< std::vector< geometrize::Scanline >(const geometrize::Shape &)> rasterize
Definition: shape.h:27
std::function< void(geometrize::Shape &)> setup
Definition: shape.h:25
std::function< void(geometrize::Shape &)> mutate
Definition: shape.h:26

◆ getType()

geometrize::ShapeTypes geometrize::Rectangle::getType ( ) const
overridevirtual

getType Gets the ShapeType of the shape.

Returns
The ShapeType of the shape.

Reimplemented from geometrize::Shape.

33{
35}
@ RECTANGLE
Definition: shapetypes.h:18

Member Data Documentation

◆ m_x1

float geometrize::Rectangle::m_x1

Left coordinate.

◆ m_x2

float geometrize::Rectangle::m_x2

Right coordinate.

◆ m_y1

float geometrize::Rectangle::m_y1

Top coordinate.

◆ m_y2

float geometrize::Rectangle::m_y2

Bottom coordinate.


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