Make parallel lines
And make TODO for P2P
This commit is contained in:
@@ -250,6 +250,9 @@ public:
|
||||
void clearByTag(int tagId, bool is_fixed_point = false);
|
||||
int addConstraint(Constraint* constr);
|
||||
void removeConstraint(Constraint* constr);
|
||||
Constraint* get_last_constraint() {
|
||||
return clist[clist.size() - 1];
|
||||
}
|
||||
|
||||
// basic constraints
|
||||
int addConstraintFixed(Point& p, int tagId = 0, bool driving = true);
|
||||
|
||||
27
GCS/Geo.cpp
27
GCS/Geo.cpp
@@ -143,6 +143,33 @@ Line::Line(Point _p1, Point _p2, int _tag) {
|
||||
tag = _tag;
|
||||
}
|
||||
|
||||
void Line::set_tag(int _tag) {
|
||||
tag = _tag;
|
||||
p1.set_tag(_tag);
|
||||
p2.set_tag(_tag);
|
||||
}
|
||||
|
||||
// TODO
|
||||
bool Line::contains(QPointF pos, qreal tol) const
|
||||
{
|
||||
double x1 = *p1.x, y1 = *p1.y;
|
||||
double x2 = *p2.x, y2 = *p2.y;
|
||||
|
||||
double A = y1 - y2;
|
||||
double B = x2 - x1;
|
||||
double C = x1 * y2 - x2 * y1;
|
||||
|
||||
try {
|
||||
double distance = abs(A * pos.x() + B * pos.y() + C) / sqrt(A * A + B * B);
|
||||
return distance < tol;
|
||||
}
|
||||
catch (...) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
DeriVector2 Line::CalculateNormal(const Point& p, const double* derivparam) const
|
||||
{
|
||||
(void)p;
|
||||
|
||||
Reference in New Issue
Block a user