support avoid-edges in all markers placements
This commit is contained in:
parent
2727eddf90
commit
fef3d22154
4 changed files with 18 additions and 6 deletions
|
@ -69,7 +69,10 @@ public:
|
|||
angle = 0;
|
||||
|
||||
box2d<double> box = this->perform_transform(angle, x, y);
|
||||
|
||||
if (this->params_.avoid_edges && !this->detector_.extent().contains(box))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!this->params_.allow_overlap && !this->detector_.has_placement(box))
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -172,6 +172,11 @@ public:
|
|||
x = last_x + dx * (spacing_left_ / segment_length);
|
||||
y = last_y + dy * (spacing_left_ / segment_length);
|
||||
box2d<double> box = this->perform_transform(angle, x, y);
|
||||
if (this->params_.avoid_edges && !this->detector_.extent().contains(box))
|
||||
{
|
||||
set_spacing_left(spacing_left_ + spacing_ * this->params_.max_error / 10.0);
|
||||
continue;
|
||||
}
|
||||
if (!this->params_.allow_overlap && !this->detector_.has_placement(box))
|
||||
{
|
||||
//10.0 is the approxmiate number of positions tried and choosen arbitrarily
|
||||
|
|
|
@ -68,7 +68,10 @@ public:
|
|||
}
|
||||
|
||||
box2d<double> box = this->perform_transform(angle, x, y);
|
||||
|
||||
if (this->params_.avoid_edges && !this->detector_.extent().contains(box))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!this->params_.allow_overlap && !this->detector_.has_placement(box))
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -32,9 +32,7 @@ class markers_vertex_last_placement : public markers_point_placement<Locator, De
|
|||
{
|
||||
public:
|
||||
markers_vertex_last_placement(Locator &locator, Detector &detector, markers_placement_params const& params)
|
||||
: markers_point_placement<Locator, Detector>(locator, detector, params)
|
||||
{
|
||||
}
|
||||
: markers_point_placement<Locator, Detector>(locator, detector, params) {}
|
||||
|
||||
bool get_point(double &x, double &y, double &angle, bool ignore_placement)
|
||||
{
|
||||
|
@ -74,7 +72,10 @@ public:
|
|||
}
|
||||
|
||||
box2d<double> box = this->perform_transform(angle, x, y);
|
||||
|
||||
if (this->params_.avoid_edges && !this->detector_.extent().contains(box))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!this->params_.allow_overlap && !this->detector_.has_placement(box))
|
||||
{
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue