RS_Entity* RS_EntityContainer::getNearestEntity(const RS_Vector& coord, double* dist, RS2::ResolveLevel level) const{ RS_DEBUG->print("RS_EntityContainer::getNearestEntity"); RS_Entity* e = nullptr; // distance for points inside solids: double solidDist = RS_MAXDOUBLE; if (dist) { solidDist = *dist; } double d = getDistanceToPoint(coord, &e, level, solidDist); if (e && e->isVisible()==false) { e = nullptr; } // if d is negative, use the default distance (used for points inside solids) if (dist) { *dist = d; } RS_DEBUG->print("RS_EntityContainer::getNearestEntity: OK"); return e; }
/** * @param tolerance Tolerance. * * @retval true if the given point is on this entity. * @retval false otherwise */ bool RS_Ellipse::isPointOnEntity(const RS_Vector& coord, double tolerance) { if ( getCenter().distanceTo(coord) < tolerance ) { if (getMajorRadius() < tolerance || getMinorRadius() < tolerance ) { return true; } else { return false; } } double dist = getDistanceToPoint(coord, NULL, RS2::ResolveNone); return (dist<=tolerance); }
/** * @param tolerance Tolerance. * * @retval true if the given point is on this entity. * @retval false otherwise */ bool RS_Ellipse::isPointOnEntity(const RS_Vector& coord, double tolerance) { double dist = getDistanceToPoint(coord, NULL, RS2::ResolveNone); return (dist<=tolerance); /* if (getMajorRadius()<1.0e-6 || getMinorRadius()<1.0e-6) { return false; } RS_Vector v = coord; v.rotate(data.center, -getAngle()); v.move(-data.center); double alpha1 = acos(v.x / getMajorRadius()); double alpha2 = asin(v.y / getMinorRadius()); std::cout << "alpha1: " << alpha1 << "\n"; std::cout << "alpha2: " << alpha2 << "\n"; return (RS_Math::getAngleDifference(alpha1, alpha2)<0.2); */ }
void AStar::setHeuristic(boost::shared_ptr<Node>node) { node->hcost = getDistanceToPoint(dims,node->pos,goal); }
/** * @param tolerance Tolerance. * * @retval true if the given point is on this entity. * @retval false otherwise */ bool RS_Entity::isPointOnEntity(const RS_Vector& coord, double tolerance) { double dist = getDistanceToPoint(coord, NULL, RS2::ResolveNone); return (dist<=tolerance); }
/** * @param tolerance Tolerance. * * @retval true if the given point is on this entity. * @retval false otherwise */ bool RS_Entity::isPointOnEntity(const RS_Vector& coord, double tolerance) const { double dist = getDistanceToPoint(coord, nullptr, RS2::ResolveNone); return (dist<=fabs(tolerance)); }
bool Observation::didPreyMoveIllegally(const Point2D &dims, const Point2D &prevAbsPrey) { unsigned int dist = getDistanceToPoint(dims,absPrey,prevAbsPrey); return (dist > 1); }