Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bindings/python/src/geometry/intersection_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@

namespace geode
{
void define_intersection_detection( pybind11::module& module )

Check warning on line 34 in bindings/python/src/geometry/intersection_detection.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/geometry/intersection_detection.cpp:34:10 [misc-use-internal-linkage]

function 'define_intersection_detection' can be made static or moved into an anonymous namespace to enforce internal linkage
{
module.def( "segment_segment_intersection_detection2D",
&segment_segment_intersection_detection );
&segment_segment_intersection_detection< 2 > );
module.def( "segment_segment_intersection_detection3D",
&segment_segment_intersection_detection< 3 > );
module.def( "colinear_segment_segment_intersection_detection2D",
&colinear_segment_segment_intersection_detection );
module.def( "segment_line_intersection_detection2D",
Expand Down
3 changes: 1 addition & 2 deletions include/geode/geometry/basic_objects/infinite_line.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
namespace geode
{
template < typename PointType, index_t dimension >
class GenericLine

Check warning on line 43 in include/geode/geometry/basic_objects/infinite_line.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/geometry/basic_objects/infinite_line.hpp:43:11 [cppcoreguidelines-special-member-functions]

class 'GenericLine' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor
{
public:
static constexpr auto dim = dimension;
Expand All @@ -57,8 +57,7 @@
[[nodiscard]] const Point< dimension >& origin() const;
[[nodiscard]] const Vector< dimension >& direction() const;
template < index_t T = dimension >
[[nodiscard]] typename std::enable_if< T == 2, double >::type
line_constant() const;
[[nodiscard]] std::enable_if_t< T == 2, double > line_constant() const;

private:
Vector< dimension > direction_;
Expand All @@ -66,7 +65,7 @@
};

template < index_t dimension >
class OwnerInfiniteLine

Check warning on line 68 in include/geode/geometry/basic_objects/infinite_line.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/geometry/basic_objects/infinite_line.hpp:68:11 [cppcoreguidelines-special-member-functions]

class 'OwnerInfiniteLine' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor
: public GenericLine< Point< dimension >, dimension >
{
using Base = GenericLine< Point< dimension >, dimension >;
Expand All @@ -86,7 +85,7 @@
ALIAS_1D_AND_2D_AND_3D( OwnerInfiniteLine );

template < index_t dimension >
class OwnerRay : public GenericLine< Point< dimension >, dimension >

Check warning on line 88 in include/geode/geometry/basic_objects/infinite_line.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/geometry/basic_objects/infinite_line.hpp:88:11 [cppcoreguidelines-special-member-functions]

class 'OwnerRay' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor
{
using Base = GenericLine< Point< dimension >, dimension >;

Expand All @@ -104,7 +103,7 @@
ALIAS_1D_AND_2D_AND_3D( OwnerRay );

template < index_t dimension >
class InfiniteLine : public GenericLine< RefPoint< dimension >, dimension >

Check warning on line 106 in include/geode/geometry/basic_objects/infinite_line.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/geometry/basic_objects/infinite_line.hpp:106:11 [cppcoreguidelines-special-member-functions]

class 'InfiniteLine' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor
{
using Base = GenericLine< RefPoint< dimension >, dimension >;

Expand All @@ -114,7 +113,7 @@
explicit InfiniteLine( const Segment< dimension >& segment );

InfiniteLine( const InfiniteLine< dimension >& other );
InfiniteLine( const OwnerInfiniteLine< dimension >& other );

Check warning on line 116 in include/geode/geometry/basic_objects/infinite_line.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/geometry/basic_objects/infinite_line.hpp:116:9 [google-explicit-constructor]

single-argument constructors must be marked explicit to avoid unintentional implicit conversions
InfiniteLine< dimension >& operator=(
const InfiniteLine< dimension >& other );
InfiniteLine( InfiniteLine< dimension >&& other ) noexcept;
Expand All @@ -124,17 +123,17 @@
ALIAS_1D_AND_2D_AND_3D( InfiniteLine );

template < index_t dimension >
class Ray : public GenericLine< RefPoint< dimension >, dimension >

Check warning on line 126 in include/geode/geometry/basic_objects/infinite_line.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/geometry/basic_objects/infinite_line.hpp:126:11 [cppcoreguidelines-special-member-functions]

class 'Ray' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor
{
using Base = GenericLine< RefPoint< dimension >, dimension >;

public:
Ray( const Vector< dimension >& direction,
const Point< dimension >& origin );
Ray( const Segment< dimension >& segment );

Check warning on line 133 in include/geode/geometry/basic_objects/infinite_line.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/geometry/basic_objects/infinite_line.hpp:133:9 [google-explicit-constructor]

single-argument constructors must be marked explicit to avoid unintentional implicit conversions

Ray( const Ray< dimension >& other );
Ray( const OwnerRay< dimension >& other );

Check warning on line 136 in include/geode/geometry/basic_objects/infinite_line.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/geometry/basic_objects/infinite_line.hpp:136:9 [google-explicit-constructor]

single-argument constructors must be marked explicit to avoid unintentional implicit conversions
Ray< dimension >& operator=( const Ray< dimension >& other );
Ray( Ray< dimension >&& other ) noexcept;
Ray< dimension >& operator=( Ray< dimension >&& other ) noexcept;
Expand Down
8 changes: 3 additions & 5 deletions include/geode/geometry/basic_objects/polygon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
namespace geode
{
template < typename PointType, index_t dimension >
class GenericPolygon

Check warning on line 47 in include/geode/geometry/basic_objects/polygon.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/geometry/basic_objects/polygon.hpp:47:11 [cppcoreguidelines-special-member-functions]

class 'GenericPolygon' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor
{
public:
static constexpr auto dim = dimension;
Expand All @@ -63,15 +63,13 @@
[[nodiscard]] Point< dimension > barycenter() const;
template < index_t T = dimension >
[[nodiscard]]
typename std::enable_if< T == 3, std::optional< Vector3D > >::type
normal() const;
std::enable_if_t< T == 3, std::optional< Vector3D > > normal() const;
template < index_t T = dimension >
[[nodiscard]]
typename std::enable_if< T == 3, std::optional< Plane > >::type
plane() const;
std::enable_if_t< T == 3, std::optional< Plane > > plane() const;
template < index_t T = dimension >
[[nodiscard]]
typename std::enable_if< T == 3, std::optional< OwnerPlane > >::type
std::enable_if_t< T == 3, std::optional< OwnerPlane > >
owner_plane() const;
[[nodiscard]] index_t nb_vertices() const;
void set_point( index_t vertex, PointType point );
Expand Down
14 changes: 6 additions & 8 deletions include/geode/geometry/basic_objects/triangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,21 @@ namespace geode
[[nodiscard]] Point< dimension > barycenter() const;
template < index_t T = dimension >
[[nodiscard]]
typename std::enable_if< T == 3, std::optional< Vector3D > >::type
normal() const;
std::enable_if_t< T == 3, std::optional< Vector3D > > normal() const;
template < index_t T = dimension >
[[nodiscard]]
typename std::enable_if< T == 3, std::optional< Plane > >::type
plane() const;
std::enable_if_t< T == 3, std::optional< Plane > > plane() const;
template < index_t T = dimension >
[[nodiscard]]
typename std::enable_if< T == 3, std::optional< OwnerPlane > >::type
std::enable_if_t< T == 3, std::optional< OwnerPlane > >
owner_plane() const;
template < index_t T = dimension >
[[nodiscard]]
typename std::enable_if< T == 3, std::optional< local_index_t > >::type
std::enable_if_t< T == 3, std::optional< local_index_t > >
pivot() const;
template < index_t T = dimension >
[[nodiscard]] typename std::enable_if< T == 3,
std::optional< std::pair< local_index_t, Vector3D > > >::type
[[nodiscard]] std::enable_if_t< T == 3,
std::optional< std::pair< local_index_t, Vector3D > > >
pivot_and_normal() const;
void set_point( local_index_t vertex, PointType point );
[[nodiscard]] const std::array< PointType, 3 >& vertices() const;
Expand Down
12 changes: 6 additions & 6 deletions include/geode/geometry/bounding_box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ namespace geode
* the bbox in 2D)
*/
template < index_t T = dimension >
[[nodiscard]] typename std::enable_if< T == 2 || T == 3, bool >::type
intersects( const Triangle< T >& triangle ) const;
[[nodiscard]] std::enable_if_t< T == 2 || T == 3, bool > intersects(
const Triangle< T >& triangle ) const;

/*!
* Returns true if the element is crossing, is inside, or is containing
* the bbox
*/
template < index_t T = dimension >
[[nodiscard]] typename std::enable_if< T == 3, bool >::type intersects(
[[nodiscard]] std::enable_if_t< T == 3, bool > intersects(
const Tetrahedron& tetra ) const;

/*!
Expand All @@ -115,12 +115,12 @@ namespace geode
const Segment< dimension >& segment ) const;

template < index_t T = dimension >
[[nodiscard]] typename std::enable_if< T == 2 || T == 3, bool >::type
[[nodiscard]] std::enable_if_t< T == 2 || T == 3, bool >
epsilon_intersects( const Triangle< T >& triangle ) const;

template < index_t T = dimension >
[[nodiscard]] typename std::enable_if< T == 3, bool >::type
epsilon_intersects( const Tetrahedron& tetra ) const;
[[nodiscard]] std::enable_if_t< T == 3, bool > epsilon_intersects(
const Tetrahedron& tetra ) const;

/*!
* Returns the distance between the point and the box.
Expand Down
6 changes: 4 additions & 2 deletions include/geode/geometry/intersection_detection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ namespace geode
* Returns outside-outside if there is no intersection or parallel-pallel
* if all points are colinear
*/
[[nodiscard]] SegmentSegmentIntersection opengeode_geometry_api
template < index_t dimension >
[[nodiscard]] SegmentSegmentIntersection
segment_segment_intersection_detection(
const Segment2D& segment0, const Segment2D& segment1 );
const Segment< dimension >& segment0,
const Segment< dimension >& segment1 );

/*!
* Detect the configuration between two 2D colinear segments
Expand Down
6 changes: 3 additions & 3 deletions include/geode/mesh/core/surface_mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,15 @@ namespace geode
*/
template < index_t T = dimension >
[[nodiscard]]
typename std::enable_if< T == 3, std::optional< Vector3D > >::type
polygon_normal( index_t polygon_id ) const;
std::enable_if_t< T == 3, std::optional< Vector3D > > polygon_normal(
index_t polygon_id ) const;

/*!
* Return the normal at a polygon vertex
*/
template < index_t T = dimension >
[[nodiscard]]
typename std::enable_if< T == 3, std::optional< Vector3D > >::type
std::enable_if_t< T == 3, std::optional< Vector3D > >
polygon_vertex_normal( index_t vertex_id ) const;

/*!
Expand Down
2 changes: 1 addition & 1 deletion src/geode/geometry/basic_objects/infinite_line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace geode
}
template < typename PointType, index_t dimension >
template < index_t T >
typename std::enable_if< T == 2, double >::type
std::enable_if_t< T == 2, double >
GenericLine< PointType, dimension >::line_constant() const
{
double line_constant{ 0.0 };
Expand Down
6 changes: 3 additions & 3 deletions src/geode/geometry/basic_objects/polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace geode

template < typename PointType, index_t dimension >
template < index_t T >
typename std::enable_if< T == 3, std::optional< Vector3D > >::type
std::enable_if_t< T == 3, std::optional< Vector3D > >
GenericPolygon< PointType, dimension >::normal() const
{
Vector3D normal;
Expand All @@ -160,7 +160,7 @@ namespace geode

template < typename PointType, index_t dimension >
template < index_t T >
typename std::enable_if< T == 3, std::optional< Plane > >::type
std::enable_if_t< T == 3, std::optional< Plane > >
GenericPolygon< PointType, dimension >::plane() const
{
if( const auto polygon_normal = this->normal() )
Expand All @@ -173,7 +173,7 @@ namespace geode

template < typename PointType, index_t dimension >
template < index_t T >
typename std::enable_if< T == 3, std::optional< OwnerPlane > >::type
std::enable_if_t< T == 3, std::optional< OwnerPlane > >
GenericPolygon< PointType, dimension >::owner_plane() const
{
if( const auto polygon_normal = this->normal() )
Expand Down
12 changes: 6 additions & 6 deletions src/geode/geometry/basic_objects/triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace geode

template < typename PointType, index_t dimension >
template < index_t T >
typename std::enable_if< T == 3, std::optional< Vector3D > >::type
std::enable_if_t< T == 3, std::optional< Vector3D > >
GenericTriangle< PointType, dimension >::normal() const
{
if( const auto result = pivot_and_normal() )
Expand All @@ -131,7 +131,7 @@ namespace geode

template < typename PointType, index_t dimension >
template < index_t T >
typename std::enable_if< T == 3, std::optional< Plane > >::type
std::enable_if_t< T == 3, std::optional< Plane > >
GenericTriangle< PointType, dimension >::plane() const
{
if( const auto triangle_normal = this->normal() )
Expand All @@ -144,7 +144,7 @@ namespace geode

template < typename PointType, index_t dimension >
template < index_t T >
typename std::enable_if< T == 3, std::optional< OwnerPlane > >::type
std::enable_if_t< T == 3, std::optional< OwnerPlane > >
GenericTriangle< PointType, dimension >::owner_plane() const
{
if( const auto triangle_normal = this->normal() )
Expand All @@ -157,7 +157,7 @@ namespace geode

template < typename PointType, index_t dimension >
template < index_t T >
typename std::enable_if< T == 3, std::optional< local_index_t > >::type
std::enable_if_t< T == 3, std::optional< local_index_t > >
GenericTriangle< PointType, dimension >::pivot() const
{
if( const auto result = pivot_and_normal() )
Expand All @@ -169,8 +169,8 @@ namespace geode

template < typename PointType, index_t dimension >
template < index_t T >
typename std::enable_if< T == 3,
std::optional< std::pair< local_index_t, Vector3D > > >::type
std::enable_if_t< T == 3,
std::optional< std::pair< local_index_t, Vector3D > > >
GenericTriangle< PointType, dimension >::pivot_and_normal() const
{
const auto result = simple_pivot_and_normal(
Expand Down
6 changes: 3 additions & 3 deletions src/geode/geometry/bounding_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,8 @@ namespace geode

template < index_t dimension >
template < index_t T >
typename std::enable_if< T == 3, bool >::type
BoundingBox< dimension >::intersects( const Tetrahedron& tetra ) const
std::enable_if_t< T == 3, bool > BoundingBox< dimension >::intersects(
const Tetrahedron& tetra ) const
{
if( point_tetrahedron_position( center(), tetra ) == POSITION::inside )
{
Expand All @@ -681,7 +681,7 @@ namespace geode

template < index_t dimension >
template < index_t T >
typename std::enable_if< T == 3, bool >::type
std::enable_if_t< T == 3, bool >
BoundingBox< dimension >::epsilon_intersects(
const Tetrahedron& tetra ) const
{
Expand Down
Loading
Loading