Merged
Conversation
Grantim
requested changes
Jul 12, 2022
source/MRMesh/MRPolylineRelax.h
Outdated
Comment on lines
+11
to
+13
| struct PolylineRelaxParams : RelaxParams | ||
| { | ||
| }; |
source/MRMesh/MRPolylineRelax.cpp
Outdated
Comment on lines
+41
to
+43
| Vector3d sum; | ||
| sum += Vector3d( polyline.points[polyline.topology.dest( e0 )] ); | ||
| sum += Vector3d( polyline.points[polyline.topology.dest( e1 )] ); |
Contributor
There was a problem hiding this comment.
polyline.destPnt( e0 );
polyline.destPnt( e1 );
Comment on lines
+36
to
+39
| auto e0 = polyline.topology.edgeWithOrg( v ); | ||
| auto e1 = polyline.topology.next( e0 ); | ||
| if ( !e0.valid() || !e1.valid() ) | ||
| return; |
Contributor
There was a problem hiding this comment.
edges are always valid, better check
!polyline.topology.isLoneEdge( e0 )
e1 is always OK if e0 is OK. For boundary edges e1 == e0
Grantim
requested changes
Jul 12, 2022
source/MRMesh/MRPolylineRelax.cpp
Outdated
Comment on lines
+60
to
+63
| using VectorD = typename SubstType<double, V>::type; | ||
| VectorD sum; | ||
| sum += VectorD( polyline.destPnt( e0 ) ); | ||
| sum += VectorD( polyline.destPnt( e1 ) ); |
Contributor
There was a problem hiding this comment.
I think we can use V here, no need to convert to double
source/MRMesh/MRPolylineRelax.h
Outdated
Comment on lines
+11
to
+20
| /// applies given number of relaxation iterations to the whole polyline ( or some region if it is specified ) | ||
| /// \return true if was finished successfully, false if was interrupted by progress callback | ||
| MRMESH_API bool relax( Polyline2& polyline, const RelaxParams& params = {}, ProgressCallback cb = {} ); | ||
| MRMESH_API bool relax( Polyline3& polyline, const RelaxParams& params = {}, ProgressCallback cb = {} ); | ||
|
|
||
| /// applies given number of relaxation iterations to the whole polyline ( or some region if it is specified ) | ||
| /// do not really keeps area but tries hard | ||
| /// \return true if was finished successfully, false if was interrupted by progress callback | ||
| MRMESH_API bool relaxKeepArea( Polyline2& polyline, const RelaxParams& params = {}, ProgressCallback cb = {} ); | ||
| MRMESH_API bool relaxKeepArea( Polyline3& polyline, const RelaxParams& params = {}, ProgressCallback cb = {} ); |
Contributor
There was a problem hiding this comment.
mb better
template<typename V>
MRMESH_API bool relax( Polyline<V>& polyline, const RelaxParams& params = {}, ProgressCallback cb = {} );
template<typename V>
MRMESH_API bool relaxKeepArea( Polyline<V>& polyline, const RelaxParams& params = {}, ProgressCallback cb = {} );
Grantim
approved these changes
Jul 12, 2022
Fedr
reviewed
Jul 12, 2022
source/MRMesh/MRPolylineRelax.h
Outdated
| @@ -0,0 +1,24 @@ | |||
| #pragma once | |||
| #include "MRMeshFwd.h" | |||
| #include "MRMeshRelax.h" | |||
Contributor
There was a problem hiding this comment.
Why include MeshRelax in PolylineRelax?
Fedr
reviewed
Jul 12, 2022
Fedr
reviewed
Jul 12, 2022
source/MRMesh/MRPolylineRelax.cpp
Outdated
| @@ -0,0 +1,130 @@ | |||
| #include "MRBitSetParallelFor.h" | |||
| #include "MRPolyline.h" | |||
| #include "MRPolylineRelax.h" | |||
Contributor
There was a problem hiding this comment.
better put it on top of all to make sure that it is self-sufficient
Fedr
approved these changes
Jul 12, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.