Skip to content

Commit ff0fe6b

Browse files
committed
Apply prepare changes
1 parent 9da3f3a commit ff0fe6b

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

bindings/python/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# This file is autogenerated by pip-compile with Python 3.10
33
# by the following command:
44
#
5-
# pip-compile bindings/python/requirements.in
5+
# pip-compile --pre bindings/python/requirements.in
66
#

include/geode/geometry/basic_objects/segment.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ namespace geode
6060
void set_point( local_index_t vertex, PointType point );
6161
[[nodiscard]] const std::array< PointType, 2 >& vertices() const;
6262
[[nodiscard]] BoundingBox< dimension > bounding_box() const;
63+
[[nodiscard]] bool is_degenerated() const;
6364

6465
private:
6566
std::array< PointType, 2 > vertices_;

src/geode/geometry/basic_objects/segment.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ namespace geode
102102
return bbox;
103103
}
104104

105+
template < typename PointType, index_t dimension >
106+
bool GenericSegment< PointType, dimension >::is_degenerated() const
107+
{
108+
return length() <= GLOBAL_EPSILON;
109+
}
110+
105111
template < index_t dimension >
106112
OwnerSegment< dimension >::OwnerSegment(
107113
Point< dimension > point0, Point< dimension > point1 ) noexcept

src/geode/geometry/basic_objects/tetrahedron.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ namespace geode
9393
const Triangle3D triangle{ point0, point1, point2 };
9494
if( triangle.is_degenerated() )
9595
{
96-
continue;
96+
return true;
9797
}
9898
for( const auto vertex3 : LRange{ 4 } )
9999
{

src/geode/geometry/basic_objects/triangle.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <absl/algorithm/container.h>
3131

3232
#include <geode/geometry/barycentric_coordinates.hpp>
33+
#include <geode/geometry/basic_objects/infinite_line.hpp>
3334
#include <geode/geometry/basic_objects/plane.hpp>
3435
#include <geode/geometry/basic_objects/segment.hpp>
3536
#include <geode/geometry/bounding_box.hpp>
@@ -277,14 +278,16 @@ namespace geode
277278
const auto next_vertex = edge_id == 2 ? 0 : edge_id + 1;
278279
const Point< dimension >& point0 = vertices_.at( edge_id );
279280
const Point< dimension >& point1 = vertices_.at( next_vertex );
280-
const auto edge_length = point_point_distance( point0, point1 );
281-
if( edge_length > GLOBAL_EPSILON )
281+
const Segment< dimension > edge{ point0, point1 };
282+
if( edge.is_degenerated() )
282283
{
283-
const auto last_vertex = next_vertex == 2 ? 0 : next_vertex + 1;
284-
const Point< dimension >& point2 = vertices_.at( last_vertex );
285-
return point_segment_distance( point2, { point0, point1 } )
286-
<= GLOBAL_EPSILON;
284+
return true;
287285
}
286+
const auto last_vertex = next_vertex == 2 ? 0 : next_vertex + 1;
287+
const Point< dimension >& point2 = vertices_.at( last_vertex );
288+
return point_line_distance(
289+
point2, InfiniteLine< dimension >{ edge } )
290+
<= GLOBAL_EPSILON;
288291
}
289292
return true;
290293
}

0 commit comments

Comments
 (0)