Skip to content

Commit

Permalink
t push origin masterMerge branch 'eddelbuettel-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
cpanse committed May 7, 2021
2 parents dcfe27d + d42cc8a commit 5ae6aad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 9 additions & 9 deletions inst/include/recmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ struct mbb_node {
if (std::sin(alpha) >= 0 && std::cos(alpha) >= 0) {
// Quad I
tanx = a.x + (dx * std::tan(alpha));
tany = a.y + (dy * std::tan(PI/2 - alpha));
tany = a.y + (dy * std::tan(M_PI/2 - alpha));

c.x = a.x + dx;
c.y = a.y + dy;
Expand All @@ -123,8 +123,8 @@ struct mbb_node {

} else if (std::sin(alpha) >= 0 && std::cos(alpha) < 0) {
// Quad II
tanx = a.x + (dx * std::tan(PI - alpha));
tany = a.y - (dy * std::tan(alpha - PI/2));
tanx = a.x + (dx * std::tan(M_PI - alpha));
tany = a.y - (dy * std::tan(alpha - M_PI/2));

c.x = a.x + dx;
c.y = a.y - dy;
Expand All @@ -135,8 +135,8 @@ struct mbb_node {

} else if (std::sin(alpha) < 0 && std::cos(alpha) < 0) {
// Quad III
tanx = a.x - (dx * std::tan(alpha - PI));
tany = a.y - (dy * std::tan(3 * PI / 2 - alpha));
tanx = a.x - (dx * std::tan(alpha - M_PI));
tany = a.y - (dy * std::tan(3 * M_PI / 2 - alpha));

c.x = a.x - dx;
c.y = a.y - dy;
Expand All @@ -147,8 +147,8 @@ struct mbb_node {

} else if (std::sin(alpha) < 0 && std::cos(alpha) > 0) {
// Quad IV
tanx = a.x - (dy * std::tan(2 * PI - alpha));
tany = a.y + (dx * std::tan(alpha - 3 * PI /2));
tanx = a.x - (dy * std::tan(2 * M_PI - alpha));
tany = a.y + (dx * std::tan(alpha - 3 * M_PI /2));

c.x = a.x - dx;
c.y = a.y + dy;
Expand Down Expand Up @@ -381,8 +381,8 @@ class RecMap{
// strategy one: try to place it in the neighborhood;
// and only one => allow non feasible solution to be filtered out
// by the metaheuristic
for (double beta = 0.0; beta <= PI && C[region_id].placed == 0;
beta += PI/180) {
for (double beta = 0.0; beta <= M_PI && C[region_id].placed == 0;
beta += M_PI/180) {
// iterate over all already placed adjacent rectangles
for (const int &adj_region_id : M[region_id].connected) {
if (C[adj_region_id].placed > 0) {
Expand Down
1 change: 1 addition & 0 deletions src/Rrecmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// 2016-04-19/20/21/22 ACCU2016 Bristol, UK
// see also: https://arxiv.org/abs/1606.00464

#define STRICT_R_HEADERS
#include <Rcpp.h>
#include <string>
#include <recmap.h>
Expand Down

0 comments on commit 5ae6aad

Please sign in to comment.