LibreCAD
|
#include <geovector.h>
Public Member Functions | |
Vector (const Coordinate &start, const Coordinate &end) | |
Vector (const Vector &v) | |
const Coordinate | start () const |
const Coordinate | end () const |
Vector & | operator= (const Vector &v) |
const Coordinate | nearestPointOnPath (const Coordinate &coord) const |
const Coordinate | nearestPointOnEntity (const Coordinate &coord) const |
double | Angle1 () const |
double | Angle2 () const |
const maths::Equation | equation () const |
virtual void | accept (GeoEntityVisitor &v) const override |
![]() | |
virtual | ~Base ()=default |
![]() | |
virtual | ~Visitable ()=default |
Private Attributes | |
Coordinate | _start |
Coordinate | _end |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Vector &e) |
Definition at line 12 of file geovector.h.
|
inlineexplicit |
Definition at line 15 of file geovector.h.
|
inline |
Definition at line 18 of file geovector.h.
|
inlineoverridevirtual |
Implements lc::Visitable.
Reimplemented in lc::entity::Line.
Definition at line 121 of file geovector.h.
|
inline |
Use nearestPointOnEntity or nearestPointOnPath and test for the distance inline bool isCoordinateOnPath(const Coordinate& coord) const {
geo::Coordinate minP(Coordinate(std::min(_start.x()-LCTOLERANCE, _end.x()-LCTOLERANCE), std::min(_start.y()-LCTOLERANCE, _end.y()-LCTOLERANCE))); geo::Coordinate maxP(Coordinate(std::max(_start.x()+LCTOLERANCE, _end.x()+LCTOLERANCE), std::max(_start.y()+LCTOLERANCE, _end.y()+LCTOLERANCE)));
bool inArea = (coord.x() >= minP.x() && coord.x() <= maxP.x() && coord.y() >= minP.y() && coord.y() <= maxP.y());
We might need a other cunction called 'isCoordinateOnEntity' and we use the below condition if (inArea && ((nearestPointOnPath(coord) - coord).magnitude() < LCTOLERANCE)) { return true; }
if ((nearestPointOnPath(coord) - coord).magnitude() < LCTOLERANCE) { return true; } return false; }
Definition at line 104 of file geovector.h.
|
inline |
Definition at line 111 of file geovector.h.
|
inline |
Definition at line 23 of file geovector.h.
|
inline |
Definition at line 115 of file geovector.h.
|
inline |
Return the nearest point on the entity
Definition at line 49 of file geovector.h.
|
inline |
Definition at line 27 of file geovector.h.
|
inline |
Definition at line 20 of file geovector.h.
|
friend |
Definition at line 124 of file geovector.h.
|
private |
Definition at line 130 of file geovector.h.
|
private |
Definition at line 129 of file geovector.h.