DGtal 1.3.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Static Private Attributes
LibBoard::Ellipse Struct Reference

An ellipse. More...

#include <Board/Shapes.h>

Inheritance diagram for LibBoard::Ellipse:
LibBoard::Shape LibBoard::Circle LibBoard::Arc

Public Member Functions

 Ellipse (double x, double y, double xRadius, double yRadius, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle lineStyle=SolidStyle, int depthValue=-1)
 
const std::string & name () const
 
Point center () const
 
Ellipserotate (double angle, const Point &center)
 
Ellipse rotated (double angle, const Point &center) const
 
Ellipserotate (double angle)
 
Ellipse rotated (double angle) const
 
Ellipsetranslate (double dx, double dy)
 
Ellipse translated (double dx, double dy) const
 
Shapescale (double sx, double sy)
 
Shapescale (double s)
 
Ellipse scaled (double sx, double sy) const
 
Ellipse 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
 
Ellipseclone () 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 ()
 
virtual const std::string & name () const
 
virtual Shapeclone () const =0
 
bool filled () const
 
virtual Point center () const =0
 
virtual Shaperotate (double angle, const Point &center)=0
 
virtual Shaperotate (double angle)=0
 
ShaperotateDeg (double angle, const Point &center)
 
ShaperotateDeg (double angle)
 
virtual Shapetranslate (double dx, double dy)=0
 
virtual Shapescale (double sx, double sy)=0
 
virtual Shapescale (double s)=0
 
virtual Rect boundingBox () const =0
 
Rect bbox ()
 
Shapeoperator-- ()
 
Shapeoperator++ ()
 
virtual void scaleAll (double s)=0
 
virtual void flushPostscript (std::ostream &stream, const TransformEPS &transform) const =0
 
virtual void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const =0
 
virtual void flushSVG (std::ostream &stream, const TransformSVG &transform) const =0
 
virtual void flushCairo (cairo_t *cr, const TransformCairo &transform) const =0
 
virtual void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const =0
 
int depth () const
 
virtual void depth (int)
 
virtual void shiftDepth (int shift)
 
const DGtal::ColorpenColor () const
 
const DGtal::ColorfillColor () const
 

Protected Attributes

Point _center
 
double _xRadius
 
double _yRadius
 
double _angle
 
bool _circle
 
- Protected Attributes inherited from LibBoard::Shape
int _depth
 
DGtal::Color _penColor
 
DGtal::Color _fillColor
 
double _lineWidth
 
LineStyle _lineStyle
 
LineCap _lineCap
 
LineJoin _lineJoin
 

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
 

Detailed Description

An ellipse.

The ellipse structure.

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

Constructor & Destructor Documentation

◆ Ellipse()

LibBoard::Ellipse::Ellipse ( double  x,
double  y,
double  xRadius,
double  yRadius,
DGtal::Color  pen,
DGtal::Color  fill,
double  lineWidth,
const LineStyle  lineStyle = SolidStyle,
int  depthValue = -1 
)
inline

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

1346 : Shape( pen, fill,
1347 lineWidth, lineStyle, ButtCap, MiterJoin, depthValue ),
1348 _center( x, y ), _xRadius( xRadius ), _yRadius( yRadius ),
1349 _angle( 0.0 ),
1350 _circle( false ) {
1351 while ( _angle > M_PI_2 ) _angle -= M_PI;
1352 while ( _angle < -M_PI_2 ) _angle += M_PI;
1353 }

References _angle.

Member Function Documentation

◆ boundingBox()

Rect LibBoard::Ellipse::boundingBox ( ) const
virtual

Returns the bounding box of the figure.

Returns
The rectangle of the bounding box.

Implements LibBoard::Shape.

Definition at line 1291 of file Shapes.cpp.

1292{
1293 if ( _angle == 0.0 )
1294 return Rect( _center.x - _xRadius, _center.y + _yRadius,
1295 2 * _xRadius, 2 * _yRadius );
1296
1297 double angleXmax = -atan( (_yRadius/_xRadius)*(tan(_angle) ) );
1298 double angleXmin = -atan( (_yRadius/_xRadius)*(tan(_angle) ) ) + M_PI;
1299 double angleYmax = atan( (_yRadius/_xRadius)*(1/tan(_angle) ) );
1300 double angleYmin = M_PI + atan( (_yRadius/_xRadius)*(1/tan(_angle) ) );
1301
1302 if ( _angle < 0.0 ) {
1303 angleYmax += M_PI;
1304 angleYmin -= M_PI;
1305 }
1306
1307 return Rect( _center.x + _xRadius*cos(angleXmin)*cos(_angle) - _yRadius*sin(angleXmin)*sin(_angle),
1308 _center.y + _xRadius*cos(angleYmax)*sin(_angle) + _yRadius*sin(angleYmax)*cos(_angle),
1309 ( _xRadius*cos(angleXmax)*cos(_angle) - _yRadius*sin(angleXmax)*sin(_angle) ) -
1310 ( _xRadius*cos(angleXmin)*cos(_angle) - _yRadius*sin(angleXmin)*sin(_angle) ),
1311 ( _xRadius*cos(angleYmax)*sin(_angle) + _yRadius*sin(angleYmax)*cos(_angle) ) -
1312 ( _xRadius*cos(angleYmin)*sin(_angle) + _yRadius*sin(angleYmin)*cos(_angle) ) );
1313}
double y
Definition: Point.h:30
double x
Definition: Point.h:29

References _angle, _center, _xRadius, _yRadius, LibBoard::Point::x, and LibBoard::Point::y.

◆ center()

Point LibBoard::Ellipse::center ( ) const
virtual

Returns the gravity center of the shape.

Returns
The center of the shape.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1026 of file Shapes.cpp.

1026 {
1027 return _center;
1028}

References _center.

Referenced by rotate(), and rotated().

◆ clone()

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

Return a copy of the shape.

Returns
copye of the shape.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1151 of file Shapes.cpp.

1151 {
1152 return new Ellipse(*this);
1153}
Aim: Model of the concept StarShaped represents any ellipse in the plane.
Definition: Ellipse2D.h:65

◆ flushCairo()

void LibBoard::Ellipse::flushCairo ( cairo_t *  cr,
const TransformCairo transform 
) const
virtual

Writes the cairo code of the shape in a cairo drawing context according to a transform.

Parameters
crThe cairo drawing context.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle, and LibBoard::Arc.

Definition at line 1232 of file Shapes.cpp.

1234{
1235 cairo_save (cr);
1236
1237 cairo_set_source_rgba (cr, _fillColor.red()/255.0, _fillColor.green()/255.0, _fillColor.blue()/255.0, 1.);
1238
1239 // tr
1240 cairo_translate (cr, transform.mapX( _center.x ), transform.mapY( _center.y ));
1241 if ( _angle != 0.0 )
1242 cairo_rotate (cr, _angle);
1243 cairo_scale (cr, transform.scale( _xRadius ), transform.scale( _yRadius ));
1244 // tr
1245
1246 cairo_arc (cr, 0, 0, 1, 0, 2*M_PI);
1247
1248 if ( filled() )
1249 {
1251 cairo_fill_preserve (cr);
1252 else
1253 cairo_fill (cr);
1254 }
1255
1256 //
1257
1259 {
1260 cairo_set_source_rgba (cr, _penColor.red()/255.0, _penColor.green()/255.0, _penColor.blue()/255.0, 1.);
1261
1262 cairo_set_line_width (cr, _lineWidth);
1263 cairo_set_line_cap (cr, cairoLineCap[_lineCap]);
1264 cairo_set_line_join (cr, cairoLineJoin[_lineJoin]);
1266
1267 cairo_stroke (cr);
1268 }
1269
1270 cairo_restore (cr);
1271}
static const Color None
Definition: Color.h:412
void green(const unsigned char aGreenValue)
void red(const unsigned char aRedValue)
void blue(const unsigned char aBlueValue)
DGtal::Color _fillColor
Definition: Board/Shapes.h:297
DGtal::Color _penColor
Definition: Board/Shapes.h:296
LineJoin _lineJoin
Definition: Board/Shapes.h:301
void setCairoDashStyle(cairo_t *cr, LineStyle type) const
Definition: Shapes.cpp:153
LineStyle _lineStyle
Definition: Board/Shapes.h:299
bool filled() const
Definition: Board/Shapes.h:111

References _angle, _center, LibBoard::Shape::_fillColor, LibBoard::Shape::_lineCap, LibBoard::Shape::_lineJoin, LibBoard::Shape::_lineStyle, LibBoard::Shape::_lineWidth, LibBoard::Shape::_penColor, _xRadius, _yRadius, DGtal::Color::blue(), LibBoard::Shape::filled(), DGtal::Color::green(), DGtal::Color::None, DGtal::Color::red(), LibBoard::Shape::setCairoDashStyle(), LibBoard::Point::x, and LibBoard::Point::y.

◆ flushFIG()

void LibBoard::Ellipse::flushFIG ( std::ostream &  stream,
const TransformFIG transform,
std::map< DGtal::Color, int > &  colormap 
) const
virtual

Writes the FIG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.
colormapA colormap.

Implements LibBoard::Shape.

Definition at line 1185 of file Shapes.cpp.

1188{
1189 // Ellipse, Sub type, Line style, Thickness
1190 if ( _circle )
1191 stream << "1 3 " << _lineStyle << " ";
1192 else
1193 stream << "1 1 " << _lineStyle << " ";
1194 stream << ( _penColor.valid()?transform.mapWidth( _lineWidth ):0 ) << " ";
1195 // Pen color, Fill color
1196 stream << colormap[ _penColor ] << " " << colormap[ _fillColor ] << " ";
1197 // Depth, Pen style, Area fill, Style val, Direction, angle
1198 if ( filled() )
1199 stream << transform.mapDepth( _depth ) << " -1 20 " << (_lineStyle?"4.000 ":"0.000 ") << " 1 " << _angle << " ";
1200 else
1201 stream << transform.mapDepth( _depth ) << " -1 -1 " << (_lineStyle?"4.000 ":"0.000 ") << " 1 " << _angle << " ";
1202 stream << static_cast<int>( transform.mapX( _center.x ) ) << " "
1203 << static_cast<int>( transform.mapY( _center.y ) ) << " "
1204 << static_cast<int>( transform.scale( _xRadius ) ) << " "
1205 << static_cast<int>( transform.scale( _yRadius ) ) << " "
1206 << static_cast<int>( transform.mapX( _center.x ) ) << " "
1207 << static_cast<int>( transform.mapY( _center.y ) ) << " "
1208 << static_cast<int>( transform.mapX( _center.x ) + transform.scale( _xRadius ) ) << " "
1209 << static_cast<int>( transform.mapY( _center.y ) ) << "\n";
1210}
bool valid() const

References _angle, _center, _circle, LibBoard::Shape::_depth, LibBoard::Shape::_fillColor, LibBoard::Shape::_lineStyle, LibBoard::Shape::_lineWidth, LibBoard::Shape::_penColor, _xRadius, _yRadius, LibBoard::Shape::filled(), DGtal::Color::valid(), LibBoard::Point::x, and LibBoard::Point::y.

◆ flushPostscript()

void LibBoard::Ellipse::flushPostscript ( std::ostream &  stream,
const TransformEPS transform 
) const
virtual

Writes the EPS code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Arc.

Definition at line 1156 of file Shapes.cpp.

1158{
1159 double yScale = _yRadius / _xRadius;
1160 stream << "\n% Ellipse\n";
1161 if ( filled() ) {
1162 stream << "gs "
1163 << transform.mapX( _center.x ) << " " << transform.mapY( _center.y ) << " tr";
1164 if ( _angle != 0.0 ) stream << " " << (_angle*180/M_PI) << " rot ";
1165 if ( ! _circle ) stream << " " << 1.0 << " " << yScale << " sc";
1166 stream << " n " << transform.scale( _xRadius ) << " 0 m "
1167 << " 0 0 " << transform.scale( _xRadius ) << " 0.0 360.0 arc ";
1168 stream << " " << _fillColor.postscript() << " srgb";
1169 stream << " fill gr" << std::endl;
1170 }
1171
1172 if ( _penColor != DGtal::Color::None ) {
1173 stream << postscriptProperties() << "\n";
1174 stream << "gs " << transform.mapX( _center.x ) << " " << transform.mapY( _center.y ) << " tr";
1175 if ( _angle != 0.0 ) stream << " " << (_angle*180/M_PI) << " rot ";
1176 if ( ! _circle ) stream << " " << 1.0 << " " << yScale << " sc";
1177 stream << " n " << transform.scale( _xRadius ) << " 0 m "
1178 << " 0 0 " << transform.scale( _xRadius ) << " 0.0 360.0 arc ";
1179 stream << " " << _penColor.postscript() << " srgb";
1180 stream << " stroke gr" << std::endl;
1181 }
1182}
std::string postscript() const
Definition: Color.cpp:150
std::string postscriptProperties() const
Definition: Shapes.cpp:140

References _angle, _center, _circle, LibBoard::Shape::_fillColor, LibBoard::Shape::_penColor, _xRadius, _yRadius, LibBoard::Shape::filled(), DGtal::Color::None, DGtal::Color::postscript(), LibBoard::Shape::postscriptProperties(), LibBoard::Point::x, and LibBoard::Point::y.

◆ flushSVG()

void LibBoard::Ellipse::flushSVG ( std::ostream &  stream,
const TransformSVG transform 
) const
virtual

Writes the SVG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle, and LibBoard::Arc.

Definition at line 1213 of file Shapes.cpp.

1215{
1216 stream << "<ellipse cx=\"" << transform.mapX( _center.x ) << '"'
1217 << " cy=\"" << transform.mapY( _center.y ) << '"'
1218 << " rx=\"" << transform.scale( _xRadius ) << '"'
1219 << " ry=\"" << transform.scale( _yRadius ) << '"'
1220 << svgProperties( transform ) ;
1221 if ( _angle != 0.0 ) {
1222 stream << " transform=\"rotate( "
1223 << -(_angle*180/M_PI) << ", "
1224 << transform.mapX( _center.x ) << ", "
1225 << transform.mapY( _center.y ) << " )\" ";
1226 }
1227 stream << " />" << std::endl;
1228}
std::string svgProperties(const TransformSVG &transform) const
Definition: Shapes.cpp:109

References _angle, _center, _xRadius, _yRadius, LibBoard::Shape::svgProperties(), LibBoard::Point::x, and LibBoard::Point::y.

◆ flushTikZ()

void LibBoard::Ellipse::flushTikZ ( std::ostream &  stream,
const TransformTikZ transform 
) const
virtual

Writes the TikZ code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle, and LibBoard::Arc.

Definition at line 1275 of file Shapes.cpp.

1277{
1278 // FIXME: unimplemented
1279 stream << "% FIXME: Ellipse::flushTikZ unimplemented" << std::endl;
1280 stream << "\\path[" << tikzProperties(transform) << "] ("
1281 << transform.mapX( _center.x ) << ','
1282 << transform.mapY( _center.y ) << ')'
1283 << " circle [x radius=" << transform.scale( _xRadius ) << ','
1284 << "y radius=" << transform.scale( _yRadius ) << ','
1285 << "rotate=" << -(_angle*180/M_PI)
1286 << "];"
1287 << std::endl;
1288}
std::string tikzProperties(const TransformTikZ &transform) const
Definition: Shapes.cpp:177

References _angle, _center, _xRadius, _yRadius, LibBoard::Shape::tikzProperties(), LibBoard::Point::x, and LibBoard::Point::y.

◆ name()

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

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

Returns
object name

Reimplemented from LibBoard::Shape.

Reimplemented in LibBoard::Circle, and LibBoard::Arc.

Definition at line 1020 of file Shapes.cpp.

1021{
1022 return _name;
1023}
static const std::string _name

References _name.

◆ rotate() [1/2]

Ellipse & LibBoard::Ellipse::rotate ( double  angle)
virtual

Rotate the shape around its center.

Parameters
angleThe rotation angle in radian.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1050 of file Shapes.cpp.

1051{
1052 return Ellipse::rotate( angle, center() );
1053}
Point center() const
Definition: Shapes.cpp:1026

References center().

◆ rotate() [2/2]

Ellipse & LibBoard::Ellipse::rotate ( double  angle,
const Point center 
)
virtual

Rotate the shape around a given center of rotation.

Parameters
angleThe rotation angle in radian.
centerThe center of rotation.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1031 of file Shapes.cpp.

1032{
1033 Point c( _center );
1034 Point e = (c + Point( _xRadius, 0 )).rotate( _angle, c );
1035 Point rc = c.rotated( angle, rotCenter );
1036 Point re = e.rotated( angle, rotCenter );
1037 Point axis = re - rc;
1038 _angle = atan( axis.y / axis.x );
1039 _center = rc;
1040 return *this;
1041}
Ellipse & rotate(double angle, const Point &center)
Definition: Shapes.cpp:1031
Ellipse rotated(double angle, const Point &center) const
Definition: Shapes.cpp:1044
MyPointD Point
Definition: testClone2.cpp:383
std::default_random_engine re

References _angle, _center, _xRadius, re, rotate(), LibBoard::Point::rotated(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by rotate(), and rotated().

◆ rotated() [1/2]

Ellipse LibBoard::Ellipse::rotated ( double  angle) const
Parameters
angleangle
Returns
an ellipse

Definition at line 1056 of file Shapes.cpp.

1057{
1058 return Ellipse(*this).rotate( angle, center() );
1059}

References center(), and rotate().

◆ rotated() [2/2]

Ellipse LibBoard::Ellipse::rotated ( double  angle,
const Point center 
) const
Parameters
angleangle
centercenter
Returns
an ellipse

Definition at line 1044 of file Shapes.cpp.

1045{
1046 return Ellipse(*this).rotate( angle, rotCenter );
1047}

References rotate().

◆ scale() [1/2]

Shape & LibBoard::Ellipse::scale ( double  s)
virtual

Scale the shape along both axis.

Parameters
sThe scale factor along both axis.
Returns
The shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1125 of file Shapes.cpp.

1126{
1127 return Ellipse::scale( s, s );
1128}

◆ scale() [2/2]

Shape & LibBoard::Ellipse::scale ( double  sx,
double  sy 
)
virtual

Scale the shape along the x an y axis.

Parameters
sxThe scale factor along the x axis.
syThe scale factor along the y axis.
Returns
The shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1075 of file Shapes.cpp.

1076{
1077 // Thanks to Freddie Exall for pointing an error with the first version
1078 // of this function, and for pointing to a fix as well!
1079 if ( _angle != 0 ) {
1080 double co = cos( _angle );
1081 double si = sin( _angle );
1082
1083 // current transformation matrix
1084 double m00 = ( 1 / _xRadius ) * co;
1085 double m01 = ( 1 / _xRadius ) * si;
1086 double m10 = - ( 1 / _yRadius ) * si;
1087 double m11 = ( 1 / _yRadius ) * co;
1088
1089 // Implicit function of ellipse at current
1090 // ax^2 + bxy + cy^2 = 1
1091 double a = ( m00 * m00 ) + ( m10 * m10 );
1092 double b = 2 * ( ( m00 * m01 ) + ( m10 * m11 ) );
1093 double c = ( m01 * m01 ) + ( m11 * m11 );
1094
1095 // Scale coefficients ( x_new = sx * x, y_new = sy * y )
1096 a = a / ( sx * sx );
1097 b = b / ( sx * sy );
1098 c = c / ( sy * sy );
1099
1100 if ( b == 0 ) {
1101 _angle = 0;
1102 } else if ( a == c ) {
1103 _angle = M_PI / 4;
1104 a += ( b / 2 );
1105 c -= ( b / 2 );
1106 } else {
1107 _angle = 0.5 * atan( b / ( a - c ) );
1108 double k = 1 + ( ( b * b ) / ( ( a - c ) * ( a - c ) ) );
1109 k = sqrt( k );
1110 k *= ( a - c );
1111 c += a;
1112 a = 0.5 * ( c + k );
1113 c = 0.5 * ( c - k );
1114 }
1115 _xRadius = 1 / sqrt( a );
1116 _yRadius = 1 / sqrt( c );
1117 } else {
1118 _xRadius = _xRadius * sx;
1119 _yRadius = _yRadius * sy;
1120 }
1121 return *this;
1122}

References _angle, _xRadius, and _yRadius.

Referenced by scaled().

◆ scaleAll()

void LibBoard::Ellipse::scaleAll ( double  s)
virtual

Scales all the values (positions, dimensions, etc.) associated with the shape.

Parameters
sThe scaling factor.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1143 of file Shapes.cpp.

1144{
1145 _xRadius *= s;
1146 _yRadius *= s;
1147 _center *= s;
1148}

References _center, _xRadius, and _yRadius.

◆ scaled() [1/2]

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

Definition at line 1137 of file Shapes.cpp.

1138{
1139 return static_cast<Ellipse &>( Ellipse(*this).scale( s, s ) );
1140}

References scale().

◆ scaled() [2/2]

Ellipse LibBoard::Ellipse::scaled ( double  sx,
double  sy 
) const
Parameters
sxscale factor
syscale factor
Returns
scaled ellipse

Definition at line 1131 of file Shapes.cpp.

1132{
1133 return static_cast<Ellipse &>( Ellipse(*this).scale( sx, sy ) );
1134}

References scale().

◆ translate()

Ellipse & LibBoard::Ellipse::translate ( double  dx,
double  dy 
)
virtual

Translate the shape by a given offset.

Parameters
dxThe x offset.
dyThe y offset.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1062 of file Shapes.cpp.

1063{
1064 _center += Point( dx, dy );
1065 return *this;
1066}

References _center.

Referenced by translated().

◆ translated()

Ellipse LibBoard::Ellipse::translated ( double  dx,
double  dy 
) const
Parameters
dxtranslation along x-axis
dytranslation along the y-axis
Returns
translated ellipse.

Definition at line 1069 of file Shapes.cpp.

1070{
1071 return Ellipse(*this).translate( dx, dy );
1072}

References translate().

Field Documentation

◆ _angle

double LibBoard::Ellipse::_angle
protected

◆ _center

Point LibBoard::Ellipse::_center
protected

◆ _circle

bool LibBoard::Ellipse::_circle
protected

◆ _name

const std::string LibBoard::Ellipse::_name
staticprivate

The generic name of the shape.

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

Referenced by name().

◆ _xRadius

double LibBoard::Ellipse::_xRadius
protected

◆ _yRadius

double LibBoard::Ellipse::_yRadius
protected

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