File tree Expand file tree Collapse file tree 5 files changed +18
-8
lines changed
include/geode/geometry/basic_objects
src/geode/geometry/basic_objects Expand file tree Collapse file tree 5 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 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#
Original file line number Diff line number Diff 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_;
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff line change 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 }
You can’t perform that action at this time.
0 commit comments