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::Triangle Class Reference

The Triangle class represents a triangle. More...

#include <triangle.h>

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

Public Member Functions

 Triangle ()=default
 
 Triangle (float x1, float y1, float x2, float y2, float x3, float y3)
 
virtual std::shared_ptr
< geometrize::Shape
clone () 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
 

Public Attributes

float m_x1
 First x-coordinate. More...
 
float m_y1
 First y-coordinate. More...
 
float m_x2
 Second x-coordinate. More...
 
float m_y2
 Second y-coordinate. More...
 
float m_x3
 Third x-coordinate. More...
 
float m_y3
 Third y-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 Triangle class represents a triangle.

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

Constructor & Destructor Documentation

geometrize::Triangle::Triangle ( )
default
geometrize::Triangle::Triangle ( float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)
11  : Shape()
12 {
13  m_x1 = x1;
14  m_y1 = y1;
15  m_x2 = x2;
16  m_y2 = y2;
17  m_x3 = x3;
18  m_y3 = y3;
19 }
float m_y2
Second y-coordinate.
Definition: triangle.h:27
float m_x3
Third x-coordinate.
Definition: triangle.h:28
float m_y1
First y-coordinate.
Definition: triangle.h:25
float m_x2
Second x-coordinate.
Definition: triangle.h:26
float m_x1
First x-coordinate.
Definition: triangle.h:24
float m_y3
Third y-coordinate.
Definition: triangle.h:29

Member Function Documentation

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

clone Clones the shape, a virtual copy constructor.

Returns
A clone of the shape.

Reimplemented from geometrize::Shape.

22 {
23  std::shared_ptr<geometrize::Triangle> triangle{std::make_shared<geometrize::Triangle>()};
24  triangle->m_x1 = m_x1;
25  triangle->m_y1 = m_y1;
26  triangle->m_x2 = m_x2;
27  triangle->m_y2 = m_y2;
28  triangle->m_x3 = m_x3;
29  triangle->m_y3 = m_y3;
30  triangle->setup = setup;
31  triangle->mutate = mutate;
32  triangle->rasterize = rasterize;
33  return triangle;
34 }
float m_y2
Second y-coordinate.
Definition: triangle.h:27
float m_x3
Third x-coordinate.
Definition: triangle.h:28
float m_y1
First y-coordinate.
Definition: triangle.h:25
float m_x2
Second x-coordinate.
Definition: triangle.h:26
float m_x1
First x-coordinate.
Definition: triangle.h:24
std::function< void(geometrize::Shape &)> mutate
Definition: shape.h:26
float m_y3
Third y-coordinate.
Definition: triangle.h:29
std::function< std::vector< geometrize::Scanline >const geometrize::Shape &)> rasterize
Definition: shape.h:27
std::function< void(geometrize::Shape &)> setup
Definition: shape.h:25
geometrize::ShapeTypes geometrize::Triangle::getType ( ) const
overridevirtual

getType Gets the ShapeType of the shape.

Returns
The ShapeType of the shape.

Reimplemented from geometrize::Shape.

37 {
38  return ShapeTypes::TRIANGLE;
39 }
Definition: shapetypes.h:20

Member Data Documentation

float geometrize::Triangle::m_x1

First x-coordinate.

float geometrize::Triangle::m_x2

Second x-coordinate.

float geometrize::Triangle::m_x3

Third x-coordinate.

float geometrize::Triangle::m_y1

First y-coordinate.

float geometrize::Triangle::m_y2

Second y-coordinate.

float geometrize::Triangle::m_y3

Third y-coordinate.


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