Skip to content
19 changes: 9 additions & 10 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,27 @@ Checks: >
-fuchsia*,
-llvmlibc*,
-llvm-header-guard,
-llvm-prefer-static-over-anonymous-namespace,
-misc-no-recursion,
-modernize-use-trailing-return-type,
-readability-redundant-access-specifiers,
-readability-convert-member-functions-to-static,
-cppcoreguidelines-avoid-const-or-ref-data-members

CheckOptions:
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: "1"
- key: readability-identifier-length.MinimumLoopCounterNameLength
value: 1
- key: readability-identifier-length.IgnoredVariableNames
value: '^[defijkptuvw]$'
value: "^[defijkptuvw]$"
# More options here: https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-naming.html
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ClassCase
value: CamelCase
value: CamelCase
- key: readability-identifier-naming.StructCase
value: CamelCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.VariableCase
Expand All @@ -51,14 +52,12 @@ CheckOptions:
- key: readability-identifier-naming.GlobalFunctionCase
value: lower_case
- key: readability-identifier-naming.MemberConstantCase
value: CamelCase
value: CamelCase
- key: readability-identifier-naming.StaticConstantCase
value: lower_case
value: lower_case
- key: readability-function-cognitive-complexity.Threshold
value: 10
- key: readability-function-size.ParameterThreshold
value: 4
- key: misc-include-cleaner.IgnoreHeaders
value: utility;cstddef;geode/.*_export\.h;geode/.*/common\.h;geode/basic/types\.h;geode/basic/assert\.h;


value: utility;cstddef;geode/.*_export\.h;geode/.*/common\.h;geode/basic/types\.h;geode/basic/assert\.h;
25 changes: 15 additions & 10 deletions bindings/python/tests/geometry/test-py-bounding-box.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
import os
import sys
import platform

if sys.version_info >= (3, 8, 0) and platform.system() == "Windows":
for path in [x.strip() for x in os.environ['PATH'].split(';') if x]:
for path in [x.strip() for x in os.environ["PATH"].split(";") if x]:
os.add_dll_directory(path)

import opengeode_py_geometry as geom

if __name__ == '__main__':
if __name__ == "__main__":
box = geom.BoundingBox2D()
box.add_point(geom.Point2D([-1, -1]))
box.add_point(geom.Point2D([1, 1]))
Expand All @@ -52,29 +53,33 @@
bbox3 = geom.BoundingBox3D()
bbox3.add_point(geom.Point3D([-1, -1, -1]))
bbox3.add_point(geom.Point3D([1, 1, 1]))

# Points
point0 = geom.Point3D([0, 0, 0])
point1 = geom.Point3D([0, 0, 2])
point2 = geom.Point3D([0, 0, -2])
# Rays
ray_inside = geom.Ray3D( geom.Vector3D([0, 0, 1]),geom.Point3D([0, 0, 0]))

ray_inside = geom.Ray3D(geom.Vector3D([0, 0, 1]), point0)
if not bbox3.intersects_ray(ray_inside):
raise ValueError("[Test] Wrong result with ray_inside")

ray_up = geom.Ray3D( geom.Vector3D([0, 0, 1]),geom.Point3D([0, 0, 2]))
ray_up = geom.Ray3D(geom.Vector3D([0, 0, 1]), point1)
if bbox3.intersects_ray(ray_up):
raise ValueError("[Test] Wrong result with ray_up")

ray_down = geom.Ray3D( geom.Vector3D([0, 0, 1]),geom.Point3D([0, 0, -2]))
ray_down = geom.Ray3D(geom.Vector3D([0, 0, 1]), point2)
if not bbox3.intersects_ray(ray_down):
raise ValueError("[Test] Wrong result with ray_down")

# Infinite lines
line_inside = geom.InfiniteLine3D( geom.Vector3D([0, 0, 1]),geom.Point3D([0, 0, 0]))
line_inside = geom.InfiniteLine3D(geom.Vector3D([0, 0, 1]), point0)
if not bbox3.intersects_infinite_line(line_inside):
raise ValueError("[Test] Wrong result with line_inside")

line_up = geom.InfiniteLine3D( geom.Vector3D([0, 0, 1]),geom.Point3D([0, 0, 2]))
line_up = geom.InfiniteLine3D(geom.Vector3D([0, 0, 1]), point1)
if not bbox3.intersects_infinite_line(line_up):
raise ValueError("[Test] Wrong result with line_up")

line_down = geom.InfiniteLine3D( geom.Vector3D([0, 0, 1]),geom.Point3D([0, 0, -2]))
line_down = geom.InfiniteLine3D(geom.Vector3D([0, 0, 1]), point2)
if not bbox3.intersects_infinite_line(line_down):
raise ValueError("[Test] Wrong result with line_down")
raise ValueError("[Test] Wrong result with line_down")
45 changes: 45 additions & 0 deletions include/geode/geometry/is_point_inside.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2019 - 2026 Geode-solutions
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

#pragma once
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: avoid 'pragma once' directive; use include guards instead [portability-avoid-pragma-once]

#pragma once
^


#include <geode/geometry/common.hpp>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header common.hpp is not used directly [misc-include-cleaner]

Suggested change

namespace geode
{
FORWARD_DECLARATION_DIMENSION_CLASS( Point );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "FORWARD_DECLARATION_DIMENSION_CLASS" is directly included [misc-include-cleaner]

include/geode/geometry/is_point_inside.hpp:25:

- #include <geode/geometry/common.hpp>
+ #include "geode/basic/common.hpp"
+ #include <geode/geometry/common.hpp>

FORWARD_DECLARATION_DIMENSION_CLASS( Polygon );
ALIAS_2D( Point );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "ALIAS_2D" is directly included [misc-include-cleaner]

    ALIAS_2D( Point );
    ^

ALIAS_2D( Polygon );
} // namespace geode

namespace geode
{
/*!
* Find if point is inside a polygon.
* @param[in] point The point to rotate.
*/
[[nodiscard]] bool opengeode_geometry_api is_point_inside_polygon(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "opengeode_geometry_api" is directly included [misc-include-cleaner]

include/geode/geometry/is_point_inside.hpp:25:

- #include <geode/geometry/common.hpp>
+ #include "geode/geometry/opengeode_geometry_export.hpp"
+ #include <geode/geometry/common.hpp>

const Point2D& point, const Polygon2D& polygon );

} // namespace geode
2 changes: 2 additions & 0 deletions src/geode/geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ add_geode_library(
"information.cpp"
"intersection.cpp"
"intersection_detection.cpp"
"is_point_inside.cpp"
"mensuration.cpp"
"nn_search.cpp"
"normal_frame_transform.cpp"
Expand Down Expand Up @@ -86,6 +87,7 @@ add_geode_library(
"information.hpp"
"intersection.hpp"
"intersection_detection.hpp"
"is_point_inside.hpp"
"mensuration.hpp"
"nn_search.hpp"
"normal_frame_transform.hpp"
Expand Down
Loading