DGtal  1.5.beta
LibBoard::Triangle Struct Reference

A triangle. Basically a Polyline with a convenient constructor. More...

#include <Board/Shapes.h>

Inheritance diagram for LibBoard::Triangle:
[legend]

Public Member Functions

 Triangle (const Point &p1, const Point &p2, const Point &p3, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depthValue=-1)
 
 Triangle (const double x1, const double y1, const double x2, const double y2, const double x3, const double y3, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depthValue=-1)
 
const std::string & name () const
 
Triangle rotated (double angle) const
 
Triangle translated (double dx, double dy) const
 
Triangle scaled (double sx, double sy) const
 
Triangle scaled (double s) const
 
Triangleclone () const
 
- Public Member Functions inherited from LibBoard::Polyline
 Polyline (const std::vector< Point > &points, bool closed, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
 
 Polyline (const Path &path, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
 
 Polyline (bool closed, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
 
Point center () const
 
Polylineoperator<< (const Point &p)
 
Pointoperator[] (const unsigned int n)
 
Polylinerotate (double angle, const Point &center)
 
Polyline rotated (double angle, const Point &center) const
 
Polylinerotate (double angle)
 
Polyline rotated (double angle) const
 
Polylinetranslate (double dx, double dy)
 
Polyline translated (double dx, double dy) const
 
Shapescale (double sx, double sy)
 
Shapescale (double s)
 
Polyline scaled (double sx, double sy) const
 
Polyline scaled (double s) const
 
void scaleAll (double s)
 
void flushPostscript (std::ostream &stream, const TransformEPS &transform) const
 
void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
 
void flushSVG (std::ostream &stream, const TransformSVG &transform) const
 
void flushCairo (cairo_t *cr, const TransformCairo &transform) const
 
void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const
 
Rect boundingBox () const
 
- Public Member Functions inherited from LibBoard::Shape
 Shape (DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
 
virtual ~Shape ()
 
bool filled () const
 
ShaperotateDeg (double angle, const Point &center)
 
ShaperotateDeg (double angle)
 
Rect bbox ()
 
Shapeoperator-- ()
 
Shapeoperator++ ()
 
int depth () const
 
virtual void depth (int)
 
virtual void shiftDepth (int shift)
 
const DGtal::ColorpenColor () const
 
const DGtal::ColorfillColor () const
 

Static Private Attributes

static const std::string _name
 

Additional Inherited Members

- Public Types inherited from LibBoard::Shape
enum  LineCap { ButtCap = 0 , RoundCap , SquareCap }
 
enum  LineJoin { MiterJoin = 0 , RoundJoin , BevelJoin }
 
enum  LineStyle {
  SolidStyle = 0 , DashStyle , DotStyle , DashDotStyle ,
  DashDotDotStyle , DashDotDotDotStyle
}
 
- Protected Member Functions inherited from LibBoard::Shape
std::string svgProperties (const TransformSVG &transform) const
 
std::string postscriptProperties () const
 
void setCairoDashStyle (cairo_t *cr, LineStyle type) const
 
std::string tikzProperties (const TransformTikZ &transform) const
 
- Protected Attributes inherited from LibBoard::Polyline
Path _path
 
- Protected Attributes inherited from LibBoard::Shape
int _depth
 
DGtal::Color _penColor
 
DGtal::Color _fillColor
 
double _lineWidth
 
LineStyle _lineStyle
 
LineCap _lineCap
 
LineJoin _lineJoin
 

Detailed Description

A triangle. Basically a Polyline with a convenient constructor.

The Triangle structure.

Definition at line 1085 of file Board/Shapes.h.

Constructor & Destructor Documentation

◆ Triangle() [1/2]

LibBoard::Triangle::Triangle ( const Point p1,
const Point p2,
const Point p3,
DGtal::Color  pen,
DGtal::Color  fill,
double  lineWidth,
const LineStyle  style = SolidStyle,
const LineCap  cap = ButtCap,
const LineJoin  join = MiterJoin,
int  depthValue = -1 
)
inline

Definition at line 1087 of file Board/Shapes.h.

1095  : Polyline( std::vector<Point>(), true, pen, fill, lineWidth, style, cap, join, depthValue ) {
1096  _path << p1;
1097  _path << p2;
1098  _path << p3;
1099  }
Polyline(const std::vector< Point > &points, bool closed, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)

References LibBoard::Polyline::_path.

Referenced by clone(), rotated(), scaled(), and translated().

◆ Triangle() [2/2]

LibBoard::Triangle::Triangle ( const double  x1,
const double  y1,
const double  x2,
const double  y2,
const double  x3,
const double  y3,
DGtal::Color  pen,
DGtal::Color  fill,
double  lineWidth,
const LineStyle  style = SolidStyle,
const LineCap  cap = ButtCap,
const LineJoin  join = MiterJoin,
int  depthValue = -1 
)
inline

Definition at line 1101 of file Board/Shapes.h.

1111  : Polyline( std::vector<Point>(), true, pen, fill, lineWidth, style, cap, join, depthValue ) {
1112  _path << Point( x1, y1 );
1113  _path << Point( x2, y2 );
1114  _path << Point( x3, y3 );
1115  }
MyPointD Point
Definition: testClone2.cpp:383

References LibBoard::Polyline::_path.

Member Function Documentation

◆ clone()

Triangle * LibBoard::Triangle::clone ( ) const
virtual

Return a copy of the shape.

Returns
copye of the shape.

Reimplemented from LibBoard::Polyline.

Definition at line 2350 of file Shapes.cpp.

2350  {
2351  return new Triangle(*this);
2352 }
Triangle(const Point &p1, const Point &p2, const Point &p3, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depthValue=-1)

References Triangle().

◆ name()

const std::string & LibBoard::Triangle::name ( ) const
virtual

Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)

Returns
object name

Reimplemented from LibBoard::Polyline.

Reimplemented in LibBoard::QuadraticBezierCurve.

Definition at line 2320 of file Shapes.cpp.

2321 {
2322  return _name;
2323 }
static const std::string _name

References _name.

◆ rotated()

Triangle LibBoard::Triangle::rotated ( double  angle) const

Definition at line 2326 of file Shapes.cpp.

2327 {
2328  return static_cast<Triangle &>( Triangle( *this ).rotate( angle ) );
2329 }
Represents an unoriented triangle as three vertices.

References Triangle().

◆ scaled() [1/2]

Triangle LibBoard::Triangle::scaled ( double  s) const

Definition at line 2344 of file Shapes.cpp.

2345 {
2346  return static_cast<Triangle &>( Triangle( *this ).scale( s ) );
2347 }

References Triangle().

◆ scaled() [2/2]

Triangle LibBoard::Triangle::scaled ( double  sx,
double  sy 
) const

Returns a scaled copy of the triangle.

Parameters
sxScale factor along the x axis.
syScale factor along the y axis.
Returns
A scaled copy of the arrow.

Definition at line 2338 of file Shapes.cpp.

2339 {
2340  return static_cast<Triangle &>( Triangle( *this ).scale( sx, sy ) );
2341 }

References Triangle().

◆ translated()

Triangle LibBoard::Triangle::translated ( double  dx,
double  dy 
) const

Returns a translated copy of the triangle.

Parameters
dxThe shift along the x axis.
dyThe shift along the y axis.
Returns
A translated copy of the line.

Definition at line 2332 of file Shapes.cpp.

2333 {
2334  return static_cast<Triangle &>( Triangle( *this ).translate( dx, dy ) );
2335 }

References Triangle().

Field Documentation

◆ _name

const std::string LibBoard::Triangle::_name
staticprivate

The generic name of the shape.

Definition at line 1151 of file Board/Shapes.h.

Referenced by name().


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