Skip to content

Commit

Permalink
fix std::array (#4)
Browse files Browse the repository at this point in the history
* stl

* fix std::array<double, 2>

* fix version

* not good

---------

Co-authored-by: TANG ZHIXIONG <zhixiong.tang@momenta.ai>
  • Loading branch information
district10 and zhixiong-tang committed Nov 23, 2023
1 parent ceef682 commit 381b493
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ project(
VERSION ${SKBUILD_PROJECT_VERSION}
LANGUAGES CXX)

if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
message(STATUS "Set build type to default: ${CMAKE_BUILD_TYPE}")
else()
message(STATUS "Your build type: ${CMAKE_BUILD_TYPE}")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
endif()

find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
# built documents.
#
# The short X.Y version.
version = '0.1.0'
version = '0.1.1'
# The full version, including alpha/beta/rc tags.
release = '0.1.0'
release = '0.1.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "scikit_build_core.build"

[project]
name = "pybind11_coordtransform"
version = "0.1.0"
version = "0.1.1"
description="c++/python version of coordtransform"
readme = "README.md"
authors = [
Expand Down
12 changes: 6 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ inline bool out_of_china(double lng, double lat)
return !(73.66 < lng && lng < 135.05 && 3.86 < lat && lat < 53.55);
}

inline std::array<double, 2> bd09togcj02(double bd_lng, double bd_lat)
inline Eigen::Vector2d bd09togcj02(double bd_lng, double bd_lat)
{
double x = bd_lng - 0.0065;
double y = bd_lat - 0.006;
Expand All @@ -53,7 +53,7 @@ inline std::array<double, 2> bd09togcj02(double bd_lng, double bd_lat)
return {gg_lng, gg_lat};
}

inline std::array<double, 2> gcj02tobd09(double lng, double lat)
inline Eigen::Vector2d gcj02tobd09(double lng, double lat)
{
double z =
std::sqrt(lng * lng + lat * lat) + 0.00002 * std::sin(lat * x_PI);
Expand All @@ -63,8 +63,8 @@ inline std::array<double, 2> gcj02tobd09(double lng, double lat)
return {bd_lng, bd_lat};
}

inline std::array<double, 2> wgs84togcj02(double lng, double lat,
bool check_output_china = true)
inline Eigen::Vector2d wgs84togcj02(double lng, double lat,
bool check_output_china = true)
{
if (check_output_china && out_of_china(lng, lat)) {
return {lng, lat};
Expand All @@ -82,8 +82,8 @@ inline std::array<double, 2> wgs84togcj02(double lng, double lat,
return {mglng, mglat};
}

inline std::array<double, 2> gcj02towgs84(double lng, double lat,
bool check_output_china = true)
inline Eigen::Vector2d gcj02towgs84(double lng, double lat,
bool check_output_china = true)
{
if (check_output_china && out_of_china(lng, lat)) {
return {lng, lat};
Expand Down
2 changes: 1 addition & 1 deletion tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@


def test_version():
assert m.__version__ == "0.1.0"
assert m.__version__ == "0.1.1"

0 comments on commit 381b493

Please sign in to comment.