3#include "MRPch/MRBindingMacros.h"
17template<
typename T,
typename R = T>
20 if ( contour.size() < 3 )
26 for (
int i = 2; i < contour.size(); ++i )
39template<
typename T,
typename R = T>
42 if ( contour.size() < 3 )
48 for (
int i = 2; i < contour.size(); ++i )
60template<
typename V,
typename R =
typename V::ValueType>
64 for (
int i = 1; i < contour.size(); ++i )
65 l += R( ( contour[i] - contour[i - 1] ).
length() );
71template<
typename V,
typename R =
typename V::ValueType>
74 if ( contour.empty() )
82 for (
size_t i = 1; i < contour.size(); ++i )
84 assert( targetLen > l );
85 auto l1 = l + R( ( contour[i] - contour[i - 1] ).
length() );
86 if ( targetLen <= l1 )
87 return 2 * targetLen < ( l + l1 ) ? i - 1 : i;
90 return contour.size() - 1;
96template<
typename To,
typename From>
100 res.reserve( from.size() );
101 for (
const auto & p : from )
102 res.emplace_back( p );
109template<
typename To,
typename From>
113 res.reserve( from.size() );
114 for (
const auto & c : from )
R calcLength(const Contour< V > &contour)
Definition MRContour.h:61
MR_BIND_IGNORE To convertContour(const From &from)
Definition MRContour.h:97
MR_BIND_IGNORE To convertContours(const From &from)
Definition MRContour.h:110
Contour2f convertContourTo2f(const From &from)
Instantiate the templates when generating bindings.
Definition MRContour.h:134
Contours2d convertContoursTo2d(const From &from)
Definition MRContour.h:141
size_t findContourPointByLength(const Contour< V > &contour, R targetLen)
Definition MRContour.h:72
R calcOrientedArea(const Contour2< T > &contour)
Definition MRContour.h:18
Contours2f convertContoursTo2f(const From &from)
Definition MRContour.h:139
Contours3f convertContoursTo3f(const From &from)
Definition MRContour.h:140
Contour3f convertContourTo3f(const From &from)
Definition MRContour.h:135
Contour2d convertContourTo2d(const From &from)
Definition MRContour.h:136
Contour3d convertContourTo3d(const From &from)
Definition MRContour.h:137
Contours3d convertContoursTo3d(const From &from)
Definition MRContour.h:142
Contour
Definition MRObjectLabel.h:20
float area(const MeshTopology &topology, const VertCoords &points, FaceId f)
returns the area of given face
Definition MRMeshMath.h:168
Contour3< float > Contour3f
Definition MRMeshFwd.h:382
Contour2< double > Contour2d
Definition MRMeshFwd.h:379
Contour2< float > Contour2f
Definition MRMeshFwd.h:380
Contours2< double > Contours2d
Definition MRMeshFwd.h:387
Contours3< float > Contours3f
Definition MRMeshFwd.h:390
Contours3< double > Contours3d
Definition MRMeshFwd.h:389
Contours2< float > Contours2f
Definition MRMeshFwd.h:388
Contour< Vector2< T > > Contour2
Definition MRMeshFwd.h:377
Contour3< double > Contour3d
Definition MRMeshFwd.h:381
Contour< Vector3< T > > Contour3
Definition MRMeshFwd.h:378
MRMESH_CLASS Vector3
Definition MRMeshFwd.h:218
std::array< Vector3f, 3 > MR_BIND_IGNORE
Definition MRMeshBuilderTypes.h:13
length
Definition MRObjectDimensionsEnum.h:17
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRVector2.h:29
T cross(const Vector2< T > &a, const Vector2< T > &b)
cross product
Definition MRVector2.h:160
Definition MRVector3.h:33