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

The RotatedRectangle class represents a rotated rectangle. More...

#include <rotatedrectangle.h>

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

Public Member Functions

 RotatedRectangle ()=default
 
 RotatedRectangle (float x1, float y1, float x2, float y2, float angle)
 
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...
 
float m_angle
 Rotation angle. 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 RotatedRectangle class represents a rotated rectangle.

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

Constructor & Destructor Documentation

◆ RotatedRectangle() [1/2]

geometrize::RotatedRectangle::RotatedRectangle ( )
default

◆ RotatedRectangle() [2/2]

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

Member Function Documentation

◆ clone()

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

clone Clones the shape, a virtual copy constructor.

Returns
A clone of the shape.

Reimplemented from geometrize::Shape.

21{
22 std::shared_ptr<geometrize::RotatedRectangle> rect{std::make_shared<geometrize::RotatedRectangle>()};
23 rect->m_x1 = m_x1;
24 rect->m_y1 = m_y1;
25 rect->m_x2 = m_x2;
26 rect->m_y2 = m_y2;
27 rect->m_angle = m_angle;
28 rect->setup = setup;
29 rect->mutate = mutate;
30 rect->rasterize = rasterize;
31 return rect;
32}
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::RotatedRectangle::getType ( ) const
overridevirtual

getType Gets the ShapeType of the shape.

Returns
The ShapeType of the shape.

Reimplemented from geometrize::Shape.

35{
37}
@ ROTATED_RECTANGLE
Definition: shapetypes.h:19

Member Data Documentation

◆ m_angle

float geometrize::RotatedRectangle::m_angle

Rotation angle.

◆ m_x1

float geometrize::RotatedRectangle::m_x1

Left coordinate.

◆ m_x2

float geometrize::RotatedRectangle::m_x2

Right coordinate.

◆ m_y1

float geometrize::RotatedRectangle::m_y1

Top coordinate.

◆ m_y2

float geometrize::RotatedRectangle::m_y2

Bottom coordinate.


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