LibreCAD
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lc::entity::Ellipse Class Reference

A ellipse that can be put in a drawing. More...

#include <ellipse.h>

Inheritance diagram for lc::entity::Ellipse:
Collaboration diagram for lc::entity::Ellipse:

Public Member Functions

 Ellipse (const geo::Coordinate &center, const geo::Coordinate &majorP, double minorRadius, double startAngle, double endAngle, bool reversed, const Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
 Create ellipse. More...
 
 Ellipse (const Ellipse_CSPtr other, bool sameID=false)
 
virtual CADEntity_CSPtr move (const geo::Coordinate &offset) const override
 move, moves by an offset More...
 
virtual CADEntity_CSPtr copy (const geo::Coordinate &offset) const override
 copy, copies by an offset More...
 
virtual CADEntity_CSPtr rotate (const geo::Coordinate &rotation_center, const double rotation_angle) const override
 rotate, rotate operation More...
 
virtual CADEntity_CSPtr scale (const geo::Coordinate &scale_center, const geo::Coordinate &scale_factor) const override
 scale, scales the entity More...
 
virtual CADEntity_CSPtr mirror (const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override
 
virtual const geo::Area boundingBox () const override
 boundingBox of the entity More...
 
virtual CADEntity_CSPtr modify (Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo, Block_CSPtr block) const override
 modify Return a new entity with the same ID bit with possible modified metainfo and/pr layer information #return new entity with same ID More...
 
std::vector< lc::geo::CoordinatefindBoxPoints () const
 
virtual std::vector
< EntityCoordinate
snapPoints (const geo::Coordinate &coord, const SimpleSnapConstrain &constrain, double minDistanceToSnap, int maxNumberOfSnapPoints) const override
 see interface Snapable More...
 
virtual geo::Coordinate nearestPointOnPath (const geo::Coordinate &coord) const override
 Find the nearest point on the path for this entity for the coordinate coord The path of a entity that it can possibly take. More...
 
virtual void accept (GeoEntityVisitor &v) const override
 
virtual void dispatch (EntityDispatch &ed) const override
 
- Public Member Functions inherited from lc::entity::CADEntity
 CADEntity ()
 
 CADEntity (Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
 CADEntity Constructor. More...
 
 CADEntity (CADEntity_CSPtr cadEntity, bool sameID)
 
 CADEntity (CADEntity_CSPtr cadEntity)
 
virtual ~CADEntity ()=default
 
Layer_CSPtr layer () const
 layer return the layer this entity is placed on More...
 
template<typename T >
const std::shared_ptr< const T > metaInfo (std::string metaName) const
 
MetaInfo_CSPtr metaInfo () const
 
Block_CSPtr block () const
 Return the current entity block. More...
 
- Public Member Functions inherited from lc::ID
 ID ()
 Default constructor, provides a new unique ID to each entity. More...
 
 ID (ID_DATATYPE)
 
virtual ~ID ()=default
 
ID_DATATYPE id () const
 returns the ID of the entity More...
 
bool operator== (const ID &id) const
 
void setID (ID_DATATYPE id)
 
- Public Member Functions inherited from lc::Visitable
virtual ~Visitable ()=default
 
- Public Member Functions inherited from lc::geo::Ellipse
 Ellipse (const Coordinate &center, const Coordinate &majorP, double minorRadius, double startAngle, double endAngle, bool reversed=false)
 
const Coordinate center () const
 center, Returns Center point of Ellipse More...
 
const Coordinate majorP () const
 majorP, Returns major point of the ellipse, relative to center More...
 
double minorRadius () const
 minorRadius, Returns the minor radius of ellipse More...
 
double startAngle () const
 startAngle, Returns Start elliptic!! angle of ellipse More...
 
double endAngle () const
 endAngle, Return the end elliptic!! angle of ellipse More...
 
Coordinate getPoint (const double &angle) const
 getPoint, return a point on ellipse with given elliptic angle More...
 
Coordinate startPoint () const
 startPoint, start point of ellipse More...
 
Coordinate endPoint () const
 endPoint, end point of ellipse More...
 
std::vector< CoordinatefindPotentialNearestPoints (const Coordinate &coord) const
 findPotentialNearestPoints More...
 
Coordinate nearestPointOnPath (const Coordinate &coord) const
 nearestPointOnPath, (ignore if it arc) More...
 
Coordinate nearestPointOnEntity (const Coordinate &coord) const
 nearestPointOnEntity, ( not ignore arc) More...
 
bool isArc () const
 isArc More...
 
bool isReversed () const
 
double ratio () const
 ratio of major radius to minor radius More...
 
double majorRadius () const
 Major Radius. More...
 
double getAngle () const
 getAngle of MajorP More...
 
double getEllipseAngle (const Coordinate &coord) const
 getEllipseAngle More...
 
bool isAngleBetween (double angle) const
 
Ellipse georotate (const Coordinate &center, const double rotation_angle) const
 rotate an ellipse at a center by an angle More...
 
Ellipse geoscale (const Coordinate &center, const Coordinate &factor) const
 scale an ellipse at some center by some factor More...
 
const maths::Equation equation () const
 Returns the quadratic equation. More...
 
- Public Member Functions inherited from lc::geo::Base
virtual ~Base ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from lc::Snapable
static void remove_ifDistanceGreaterThen (std::vector< EntityCoordinate > &points, const geo::Coordinate &reference, const double distance)
 
static void snapPointsCleanup (std::vector< EntityCoordinate > &points, const geo::Coordinate &reference, const unsigned int maxNumberOfSnapPoints, const double minDistanceToSnap)
 
- Static Public Attributes inherited from lc::ID
static std::atomic< ID_DATATYPE__idCounter
 
- Protected Member Functions inherited from lc::entity::CADEntity
 CADEntity (const lc::builder::CADEntityBuilder &builder)
 

Detailed Description

A ellipse that can be put in a drawing.

A Ellipse is a graphics elipse item that can be put on a drawing using a CreateEntity operation.

See also
CreateEntities::append
Author
R. van Twisk
Date
2012-04-16

Definition at line 27 of file ellipse.h.

Constructor & Destructor Documentation

Ellipse::Ellipse ( const geo::Coordinate center,
const geo::Coordinate majorP,
double  minorRadius,
double  startAngle,
double  endAngle,
bool  reversed,
const Layer_CSPtr  layer,
const MetaInfo_CSPtr  metaInfo = nullptr,
const Block_CSPtr  block = nullptr 
)

Create ellipse.

Parameters
center
majorPrelative to center
minorRadius
startAngle
endAngle
reversed
layer
metaInfo
block

Definition at line 9 of file ellipse.cpp.

17  :
19  geo::Ellipse(center, majorP, minorRadius, startAngle, endAngle, reversed) {
20 }
double startAngle() const
startAngle, Returns Start elliptic!! angle of ellipse
Definition: geoellipse.cpp:32
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
double endAngle() const
endAngle, Return the end elliptic!! angle of ellipse
Definition: geoellipse.cpp:189
double minorRadius() const
minorRadius, Returns the minor radius of ellipse
Definition: geoellipse.cpp:28
Ellipse::Ellipse ( const Ellipse_CSPtr  other,
bool  sameID = false 
)

Definition at line 22 of file ellipse.cpp.

22  :
23  CADEntity(other, sameID),
24  geo::Ellipse(other->center(), other->majorP(), other->minorRadius(), other->startAngle(), other->endAngle(),
25  other->isReversed()) {
26 }

Member Function Documentation

virtual void lc::entity::Ellipse::accept ( GeoEntityVisitor v) const
inlineoverridevirtual

Reimplemented from lc::entity::CADEntity.

Definition at line 117 of file ellipse.h.

117 { v.visit(*this); }
const geo::Area Ellipse::boundingBox ( ) const
overridevirtual

boundingBox of the entity

Returns
geo::Area area

Implements lc::entity::CADEntity.

Definition at line 112 of file ellipse.cpp.

112  {
113  const std::vector<geo::Coordinate> points = findBoxPoints();
114  double minX, minY, maxX, maxY;
115 
116  minX = points[0].x();
117  maxX = points[0].x();
118  minY = points[0].y();
119  maxY = points[0].y();
120 
121  const auto checkPoint = [&](const geo::Coordinate& point) {
122  if (point.x() < minX)
123  minX = point.x();
124  if (point.x() > maxX)
125  maxX = point.x();
126  if (point.y() < minY)
127  minY = point.y();
128  if (point.y() > maxY)
129  maxY = point.y();
130  };
131 
132  for (const auto& point : points)
133  checkPoint(point);
134 
135  return geo::Area(geo::Coordinate(minX, minY),
136  geo::Coordinate(maxX, maxY));
137 }
std::vector< lc::geo::Coordinate > findBoxPoints() const
Definition: ellipse.cpp:158
CADEntity_CSPtr Ellipse::copy ( const geo::Coordinate offset) const
overridevirtual

copy, copies by an offset

Parameters
geo::Coordinateoffset
Returns
CADEntity_CSPtr copied entity

Implements lc::entity::CADEntity.

Definition at line 42 of file ellipse.cpp.

42  {
43  auto newEllipse = std::make_shared<Ellipse>(this->center() + offset,
44  this->majorP(),
45  this->minorRadius(),
46  this->startAngle(), this->endAngle(),
47  isReversed(),
48  layer(),
49  metaInfo(),
50  block());
51  return newEllipse;
52 }
bool isReversed() const
Definition: geoellipse.cpp:206
double startAngle() const
startAngle, Returns Start elliptic!! angle of ellipse
Definition: geoellipse.cpp:32
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
double endAngle() const
endAngle, Return the end elliptic!! angle of ellipse
Definition: geoellipse.cpp:189
const Coordinate center() const
center, Returns Center point of Ellipse
Definition: geoellipse.cpp:20
double minorRadius() const
minorRadius, Returns the minor radius of ellipse
Definition: geoellipse.cpp:28
const Coordinate majorP() const
majorP, Returns major point of the ellipse, relative to center
Definition: geoellipse.cpp:24
virtual void lc::entity::Ellipse::dispatch ( EntityDispatch ed) const
inlineoverridevirtual

Implements lc::entity::CADEntity.

Definition at line 119 of file ellipse.h.

119  {
120  ed.visit(shared_from_this());
121  }
std::vector< lc::geo::Coordinate > Ellipse::findBoxPoints ( ) const
Returns
left, right, top, bottom, startPoint(for arc), endPoint(for arc)

Definition at line 158 of file ellipse.cpp.

158  {
159  std::vector<lc::geo::Coordinate> resPoints;
160  const double a = majorP().magnitude();
161  const double b = this->minorRadius();
162  const double angle = this->getAngle();
163  geo::Coordinate c1, c2, c3, c4;
164  bool simple = false; // (major axis = ox axis) or (major axis = oy axis)
165 
166  if (sin(angle) == 0) {
167  c1 = geo::Coordinate(this->center().x() + a, this->center().y());
168  c2 = geo::Coordinate(this->center().x(), this->center().y() + b);
169  c3 = geo::Coordinate(this->center().x() - a, this->center().y());
170  c4 = geo::Coordinate(this->center().x(), this->center().y() - b);
171 
172  simple = true;
173  }
174 
175  if (cos(angle) == 0) {
176  c1 = geo::Coordinate(this->center().x() + b, this->center().y());
177  c2 = geo::Coordinate(this->center().x(), this->center().y() + a);
178  c3 = geo::Coordinate(this->center().x() - b, this->center().y());
179  c4 = geo::Coordinate(this->center().x(), this->center().y() - a);
180 
181  simple = true;
182  }
183 
184  if (!simple) {
185  double tanAngle = std::tan(-this->getAngle());
186 
187  auto getY = [&](double x) {
188  return -b * b * x / (a * a * tanAngle);
189  };
190 
191  double x = a * a * tanAngle / (sqrt(a * a * tanAngle * tanAngle + b * b));
192  c1 = geo::Coordinate(x, getY(x));
193  c2 = geo::Coordinate(-x, getY(-x));
194 
195  tanAngle = -1 / tanAngle;
196  x = a * a * tanAngle / (sqrt(a * a * tanAngle * tanAngle + b * b));
197  c3 = geo::Coordinate(x, getY(x));
198  c4 = geo::Coordinate(-x, getY(-x));
199 
200  c1 = c1.rotate(angle) + this->center();
201  c2 = c2.rotate(angle) + this->center();
202  c3 = c3.rotate(angle) + this->center();
203  c4 = c4.rotate(angle) + this->center();
204  }
205 
206  if (this->isArc()) {
207  resPoints.push_back(startPoint());
208  resPoints.push_back(endPoint());
209  }
210 
211  auto checkPoint = [&](geo::Coordinate cord) {
212  if (isAngleBetween(getEllipseAngle(cord)))
213  resPoints.push_back(cord);
214  };
215 
216  checkPoint(c1);
217  checkPoint(c2);
218  checkPoint(c3);
219  checkPoint(c4);
220 
221  return resPoints;
222 }
Coordinate startPoint() const
startPoint, start point of ellipse
Definition: geoellipse.cpp:199
double getEllipseAngle(const Coordinate &coord) const
getEllipseAngle
Definition: geoellipse.cpp:218
bool isArc() const
isArc
Definition: geoellipse.cpp:214
double magnitude() const
Coordinate rotate(const Coordinate &angleVector) const
rotate around (0.,0.) with a given angle vector
double getAngle() const
getAngle of MajorP
Definition: geoellipse.cpp:40
Coordinate endPoint() const
endPoint, end point of ellipse
Definition: geoellipse.cpp:202
const Coordinate center() const
center, Returns Center point of Ellipse
Definition: geoellipse.cpp:20
double minorRadius() const
minorRadius, Returns the minor radius of ellipse
Definition: geoellipse.cpp:28
const Coordinate majorP() const
majorP, Returns major point of the ellipse, relative to center
Definition: geoellipse.cpp:24
bool isAngleBetween(double angle) const
Definition: geoellipse.h:127
CADEntity_CSPtr Ellipse::mirror ( const geo::Coordinate axis1,
const geo::Coordinate axis2 
) const
overridevirtual

Implements lc::entity::CADEntity.

Definition at line 87 of file ellipse.cpp.

87  {
88  auto cen = this->center().mirror(axis1, axis2);
89  auto maj = (cen + this->majorP()).mirror(axis1, axis2);
90  auto majP = maj - cen;
91 
92  geo::Coordinate startP, endP;
93  if (isArc()) {
94  startP = startPoint().mirror(axis1, axis2);
95  endP = endPoint().mirror(axis1, axis2);
96  }
97 
98  auto newEllipse = std::make_shared<Ellipse>(cen, majP,
99  minorRadius(),
100  getEllipseAngle(startP),
101  getEllipseAngle(endP),
102  !isReversed(),
103  layer(),
104  metaInfo(),
105  block()
106  );
107  newEllipse->setID(this->id());
108 
109  return newEllipse;
110 }
Coordinate mirror(const Coordinate &axis1, const Coordinate &axis2) const
mirror a coordinate
bool isReversed() const
Definition: geoellipse.cpp:206
Coordinate startPoint() const
startPoint, start point of ellipse
Definition: geoellipse.cpp:199
double getEllipseAngle(const Coordinate &coord) const
getEllipseAngle
Definition: geoellipse.cpp:218
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
bool isArc() const
isArc
Definition: geoellipse.cpp:214
virtual CADEntity_CSPtr mirror(const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override
Definition: ellipse.cpp:87
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
Coordinate endPoint() const
endPoint, end point of ellipse
Definition: geoellipse.cpp:202
const Coordinate center() const
center, Returns Center point of Ellipse
Definition: geoellipse.cpp:20
double minorRadius() const
minorRadius, Returns the minor radius of ellipse
Definition: geoellipse.cpp:28
const Coordinate majorP() const
majorP, Returns major point of the ellipse, relative to center
Definition: geoellipse.cpp:24
CADEntity_CSPtr Ellipse::modify ( Layer_CSPtr  layer,
const MetaInfo_CSPtr  metaInfo,
Block_CSPtr  block 
) const
overridevirtual

modify Return a new entity with the same ID bit with possible modified metainfo and/pr layer information #return new entity with same ID

Implements lc::entity::CADEntity.

Definition at line 139 of file ellipse.cpp.

139  {
140  auto newEntity = std::make_shared<Ellipse>(
141  this->center(),
142  this->majorP(),
143  this->minorRadius(),
144  this->startAngle(),
145  this->endAngle(),
146  this->isReversed(),
147  layer,
148  metaInfo,
149  block
150  );
151 
152  newEntity->setID(this->id());
153 
154  return newEntity;
155 }
bool isReversed() const
Definition: geoellipse.cpp:206
double startAngle() const
startAngle, Returns Start elliptic!! angle of ellipse
Definition: geoellipse.cpp:32
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
double endAngle() const
endAngle, Return the end elliptic!! angle of ellipse
Definition: geoellipse.cpp:189
const Coordinate center() const
center, Returns Center point of Ellipse
Definition: geoellipse.cpp:20
double minorRadius() const
minorRadius, Returns the minor radius of ellipse
Definition: geoellipse.cpp:28
const Coordinate majorP() const
majorP, Returns major point of the ellipse, relative to center
Definition: geoellipse.cpp:24
CADEntity_CSPtr Ellipse::move ( const geo::Coordinate offset) const
overridevirtual

move, moves by an offset

Parameters
geo::Coordinateoffset
Returns
CADEntity_CSPtr moved entity

Implements lc::entity::CADEntity.

Definition at line 29 of file ellipse.cpp.

29  {
30  auto newellipse = std::make_shared<Ellipse>(this->center() + offset,
31  this->majorP(),
32  this->minorRadius(),
33  this->startAngle(), this->endAngle(),
34  isReversed(),
35  layer(),
36  metaInfo(),
37  block());
38  newellipse->setID(this->id());
39  return newellipse;
40 }
bool isReversed() const
Definition: geoellipse.cpp:206
double startAngle() const
startAngle, Returns Start elliptic!! angle of ellipse
Definition: geoellipse.cpp:32
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
double endAngle() const
endAngle, Return the end elliptic!! angle of ellipse
Definition: geoellipse.cpp:189
const Coordinate center() const
center, Returns Center point of Ellipse
Definition: geoellipse.cpp:20
double minorRadius() const
minorRadius, Returns the minor radius of ellipse
Definition: geoellipse.cpp:28
const Coordinate majorP() const
majorP, Returns major point of the ellipse, relative to center
Definition: geoellipse.cpp:24
geo::Coordinate Ellipse::nearestPointOnPath ( const geo::Coordinate coord) const
overridevirtual

Find the nearest point on the path for this entity for the coordinate coord The path of a entity that it can possibly take.

For example for any Arc the path is the full circle if the start/stop angle is 0 to 2*pi

Parameters
coordCoordinate to lookup the nearest coordinate from
See also
lc::entity::CADEntity

Implements lc::Snapable.

Definition at line 282 of file ellipse.cpp.

282  {
283  return geo::Ellipse::nearestPointOnPath(coord);
284 }
Coordinate nearestPointOnPath(const Coordinate &coord) const
nearestPointOnPath, (ignore if it arc)
Definition: geoellipse.cpp:149
CADEntity_CSPtr Ellipse::rotate ( const geo::Coordinate rotation_center,
const double  rotation_angle 
) const
overridevirtual

rotate, rotate operation

Parameters
geo::Coordinaterotation_center
doublerotation_angle
Returns
CADEntity_CSPtr rotated entity

Implements lc::entity::CADEntity.

Definition at line 54 of file ellipse.cpp.

54  {
55  auto rotated = this->georotate(rotation_center, rotation_angle);
56  auto newEllipse = std::make_shared<Ellipse>(rotated.center(),
57  rotated.majorP(),
58  rotated.minorRadius(),
59  rotated.startAngle(),
60  rotated.endAngle(),
61  isReversed(),
62  layer(),
63  metaInfo(),
64  block()
65  );
66  newEllipse->setID(this->id());
67  return newEllipse;
68 }
bool isReversed() const
Definition: geoellipse.cpp:206
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
Ellipse georotate(const Coordinate &center, const double rotation_angle) const
rotate an ellipse at a center by an angle
Definition: geoellipse.cpp:82
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
CADEntity_CSPtr Ellipse::scale ( const geo::Coordinate scale_center,
const geo::Coordinate scale_factor 
) const
overridevirtual

scale, scales the entity

Parameters
geo::Coordinatescale_center
doublescale_factor
Returns

Implements lc::entity::CADEntity.

Definition at line 70 of file ellipse.cpp.

70  {
71  auto scaled = this->geoscale(scale_center, scale_factor);
72  auto newEllipse = std::make_shared<Ellipse>(scaled.center(),
73  scaled.majorP(),
74  scaled.minorRadius(),
75  scaled.startAngle(),
76  scaled.endAngle(),
77  isReversed(),
78  layer(),
79  metaInfo(),
80  block()
81  );
82 
83  newEllipse->setID(this->id());
84  return newEllipse;
85 }
bool isReversed() const
Definition: geoellipse.cpp:206
Ellipse geoscale(const Coordinate &center, const Coordinate &factor) const
scale an ellipse at some center by some factor
Definition: geoellipse.cpp:44
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
std::vector< EntityCoordinate > Ellipse::snapPoints ( const geo::Coordinate coord,
const SimpleSnapConstrain constrain,
double  minDistanceToSnap,
int  maxNumberOfSnapPoints 
) const
overridevirtual

see interface Snapable

Implements lc::Snapable.

Definition at line 226 of file ellipse.cpp.

227  {
228 
229  std::vector<EntityCoordinate> resPoints;
230  int ind = 0;
231 
232  if (constrain.constrain() & SimpleSnapConstrain::LOGICAL) {
233  geo::Coordinate tmp;
234 
235  resPoints.emplace_back(this->center(), ind++);
236 
237  auto points = this->findBoxPoints();
238  for (auto p: points)
239  resPoints.emplace_back(p, ind++);
240 
241  geo::Coordinate minorP(this->majorP().angle());
242  minorP = minorP.rotate(M_PI_2);
243  minorP = minorP * this->minorRadius();
244 
245  if (sin(this->getAngle()) != 0 && cos(this->getAngle()) != 0) {
246  //add Ellipse vertices
247  tmp = center() + majorP();
248  if (this->isAngleBetween(0))
249  resPoints.emplace_back(tmp, ind++);
250 
251  tmp = center() - majorP();
252  if (this->isAngleBetween(M_PI))
253  resPoints.emplace_back(tmp, ind++);
254 
255  tmp = center() + minorP;
256  if (this->isAngleBetween(M_PI_2))
257  resPoints.emplace_back(tmp, ind++);
258 
259  tmp = center() - minorP;
260  if (this->isAngleBetween(-M_PI_2))
261  resPoints.emplace_back(tmp, ind++);
262  }
263  }
264 
265  // Any where on entity path
266  if (constrain.constrain() & SimpleSnapConstrain::ON_ENTITYPATH) {
267  geo::Coordinate nearestPoint = this->nearestPointOnPath(coord);
268  resPoints.emplace_back(nearestPoint, ind++);
269  }
270 
271  // Any where on entity
272  if (constrain.constrain() & SimpleSnapConstrain::ON_ENTITY) {
273  geo::Coordinate nearestPoint = nearestPointOnEntity(coord);
274  resPoints.emplace_back(nearestPoint, ind++);
275  }
276 
277  // Cleanup array of snappoints
278  Snapable::snapPointsCleanup(resPoints, coord, maxNumberOfSnapPoints, minDistanceToSnap);
279  return resPoints;
280 }
virtual geo::Coordinate nearestPointOnPath(const geo::Coordinate &coord) const override
Find the nearest point on the path for this entity for the coordinate coord The path of a entity that...
Definition: ellipse.cpp:282
std::vector< lc::geo::Coordinate > findBoxPoints() const
Definition: ellipse.cpp:158
static const uint16_t LOGICAL
Definition: snapconstrain.h:22
static const uint16_t ON_ENTITYPATH
Definition: snapconstrain.h:19
static const uint16_t ON_ENTITY
Definition: snapconstrain.h:18
static void snapPointsCleanup(std::vector< EntityCoordinate > &points, const geo::Coordinate &reference, const unsigned int maxNumberOfSnapPoints, const double minDistanceToSnap)
Definition: snapable.h:53
#define M_PI
Definition: const.h:16
double getAngle() const
getAngle of MajorP
Definition: geoellipse.cpp:40
const uint16_t constrain() const
Definition: snapconstrain.h:47
const Coordinate center() const
center, Returns Center point of Ellipse
Definition: geoellipse.cpp:20
double minorRadius() const
minorRadius, Returns the minor radius of ellipse
Definition: geoellipse.cpp:28
Coordinate nearestPointOnEntity(const Coordinate &coord) const
nearestPointOnEntity, ( not ignore arc)
Definition: geoellipse.cpp:167
const Coordinate majorP() const
majorP, Returns major point of the ellipse, relative to center
Definition: geoellipse.cpp:24
bool isAngleBetween(double angle) const
Definition: geoellipse.h:127

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