File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838#include < geode/basic/pimpl_impl.hpp>
3939#include < geode/basic/uuid.hpp>
4040
41+ #include < geode/geometry/angle.hpp>
4142#include < geode/geometry/basic_objects/infinite_line.hpp>
4243#include < geode/geometry/basic_objects/polygon.hpp>
4344#include < geode/geometry/basic_objects/segment.hpp>
@@ -1205,9 +1206,20 @@ namespace geode
12051206 Vector3D normal;
12061207 for ( const auto & polygon : polygons_around_vertex ( vertex_id ) )
12071208 {
1208- if ( const auto p_normal = polygon_normal ( polygon.polygon_id ) )
1209+ const auto polygon_id = polygon.polygon_id ;
1210+ if ( const auto p_normal = polygon_normal ( polygon_id ) )
12091211 {
1210- normal = normal + p_normal.value ();
1212+ const auto previous_vertex =
1213+ this ->previous_polygon_vertex ( polygon );
1214+ const auto next_vertex = this ->next_polygon_vertex ( polygon );
1215+ const Vector3D prev{ this ->point ( this ->polygon_vertex (
1216+ previous_vertex ) ),
1217+ this ->point ( vertex_id ) };
1218+ const Vector3D next{ this ->point (
1219+ this ->polygon_vertex ( next_vertex ) ),
1220+ this ->point ( vertex_id ) };
1221+ const auto angle = Angle::create_from_vectors ( prev, next );
1222+ normal = normal + p_normal.value () * angle.radians ();
12111223 }
12121224 }
12131225 try
You can’t perform that action at this time.
0 commit comments