generated from cubao/pybind11-rdp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update docker * update headers * fix * init flatbush from headers * minor fix, more test * add densify polyline * more syncs * more syncs * lint code * update headers * trivial update * update * rebase headers --------- Co-authored-by: TANG ZHIXIONG <[email protected]>
- Loading branch information
1 parent
cd6c8a1
commit 2b4582e
Showing
13 changed files
with
563 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule headers
updated
77 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,7 +124,7 @@ def build_extension(self, ext): | |
# logic and declaration, and simpler if you include description/version in a file. | ||
setup( | ||
name="fast_crossing", | ||
version="0.0.7", | ||
version="0.0.8", | ||
author="tzx", | ||
author_email="[email protected]", | ||
url="https://fast-crossing.readthedocs.io", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// should sync | ||
// - https://github.com/cubao/fast-crossing/blob/master/src/densify_polyline.hpp | ||
// - | ||
// https://github.com/cubao/headers/tree/main/include/cubao/densify_polyline.hpp | ||
|
||
#ifndef CUBAO_DENSIFY_POLYLINE_HPP | ||
#define CUBAO_DENSIFY_POLYLINE_HPP | ||
|
||
#include <Eigen/Core> | ||
|
||
namespace cubao | ||
{ | ||
using RowVectors = Eigen::Matrix<double, Eigen::Dynamic, 3, Eigen::RowMajor>; | ||
inline RowVectors densify_polyline(const Eigen::Ref<const RowVectors> &coords, | ||
double max_gap) | ||
{ | ||
if (coords.rows() < 2 || max_gap <= 0) { | ||
return coords; | ||
} | ||
std::vector<Eigen::Vector3d> xyzs; | ||
const int N = coords.rows(); | ||
xyzs.reserve(N); | ||
for (int i = 0; i < N - 1; i++) { | ||
const Eigen::RowVector3d &curr = coords.row(i); | ||
const Eigen::RowVector3d &next = coords.row(i + 1); | ||
Eigen::RowVector3d dir = next - curr; | ||
double gap = dir.norm(); | ||
if (gap == 0) { | ||
continue; | ||
} | ||
dir /= gap; | ||
if (gap <= max_gap) { | ||
xyzs.push_back(curr); | ||
continue; | ||
} | ||
RowVectors pos(1 + int(std::ceil(gap / max_gap)), 3); | ||
pos.col(0) = Eigen::ArrayXd::LinSpaced(pos.rows(), curr[0], next[0]); | ||
pos.col(1) = Eigen::ArrayXd::LinSpaced(pos.rows(), curr[1], next[1]); | ||
pos.col(2) = Eigen::ArrayXd::LinSpaced(pos.rows(), curr[2], next[2]); | ||
int M = pos.rows() - 1; | ||
int N = xyzs.size(); | ||
xyzs.resize(N + M); | ||
Eigen::Map<RowVectors>(&xyzs[N][0], M, 3) = pos.topRows(M); | ||
} | ||
xyzs.push_back(coords.row(N - 1)); | ||
return Eigen::Map<const RowVectors>(&xyzs[0][0], xyzs.size(), 3); | ||
} | ||
} // namespace cubao | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.