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

The QuadraticBezier class represents a quadratic bezier curve. More...

#include <quadraticbezier.h>

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

Public Member Functions

 QuadraticBezier ()=default
 
 QuadraticBezier (float cx, float cy, 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_cx
 Control point x-coordinate. More...
 
float m_cy
 Control point y-coordinate. More...
 
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...
 
- 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 QuadraticBezier class represents a quadratic bezier curve.

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

Constructor & Destructor Documentation

◆ QuadraticBezier() [1/2]

geometrize::QuadraticBezier::QuadraticBezier ( )
default

◆ QuadraticBezier() [2/2]

geometrize::QuadraticBezier::QuadraticBezier ( float  cx,
float  cy,
float  x1,
float  y1,
float  x2,
float  y2 
)
10 : Shape()
11{
12 m_cx = cx;
13 m_cy = cy;
14 m_x1 = x1;
15 m_y1 = y1;
16 m_x2 = x2;
17 m_y2 = y2;
18}
float m_x1
First x-coordinate.
Definition: quadraticbezier.h:26
float m_y2
Second y-coordinate.
Definition: quadraticbezier.h:29
float m_cy
Control point y-coordinate.
Definition: quadraticbezier.h:25
float m_cx
Control point x-coordinate.
Definition: quadraticbezier.h:24
float m_x2
Second x-coordinate.
Definition: quadraticbezier.h:28
float m_y1
First y-coordinate.
Definition: quadraticbezier.h:27

Member Function Documentation

◆ clone()

std::shared_ptr< geometrize::Shape > geometrize::QuadraticBezier::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::QuadraticBezier> bezier{std::make_shared<geometrize::QuadraticBezier>()};
23 bezier->m_x1 = m_x1;
24 bezier->m_y1 = m_y1;
25 bezier->m_cx = m_cx;
26 bezier->m_cy = m_cy;
27 bezier->m_x2 = m_x2;
28 bezier->m_y2 = m_y2;
29 bezier->setup = setup;
30 bezier->mutate = mutate;
31 bezier->rasterize = rasterize;
32 return bezier;
33}
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::QuadraticBezier::getType ( ) const
overridevirtual

getType Gets the ShapeType of the shape.

Returns
The ShapeType of the shape.

Reimplemented from geometrize::Shape.

36{
38}
@ QUADRATIC_BEZIER
Definition: shapetypes.h:25

Member Data Documentation

◆ m_cx

float geometrize::QuadraticBezier::m_cx

Control point x-coordinate.

◆ m_cy

float geometrize::QuadraticBezier::m_cy

Control point y-coordinate.

◆ m_x1

float geometrize::QuadraticBezier::m_x1

First x-coordinate.

◆ m_x2

float geometrize::QuadraticBezier::m_x2

Second x-coordinate.

◆ m_y1

float geometrize::QuadraticBezier::m_y1

First y-coordinate.

◆ m_y2

float geometrize::QuadraticBezier::m_y2

Second y-coordinate.


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