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 )
30 area += cross( p2 - p0, p1 - p0 );
39template<
typename T,
typename R = T>
42 if ( contour.size() < 3 )
48 for (
int i = 2; i < contour.size(); ++i )
52 area += cross( p1 - p0, p2 - p0 );
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 )
122MR_BIND_TEMPLATE(
float calcOrientedArea(
const Contour2<float> & contour ) )
123MR_BIND_TEMPLATE(
double calcOrientedArea(
const Contour2<double> & contour ) )
124MR_BIND_TEMPLATE(
float calcLength(
const Contour2<float>& contour ) )
125MR_BIND_TEMPLATE(
double calcLength(
const Contour2<double>& contour ) )
126MR_BIND_TEMPLATE(
float calcLength(
const Contour3<float>& contour ) )
127MR_BIND_TEMPLATE(
double calcLength(
const Contour3<double>& contour ) )
128MR_BIND_TEMPLATE( Vector3<float>
calcOrientedArea(
const Contour3<float> & contour ) )
129MR_BIND_TEMPLATE( Vector3<double>
calcOrientedArea(
const Contour3<double> & contour ) )
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
size_t findContourPointByLength(const Contour< V > &contour, R targetLen)
Definition MRContour.h:72
R calcOrientedArea(const Contour2< T > &contour)
Definition MRContour.h:18
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
std::array< Vector3f, 3 > MR_BIND_IGNORE
Definition MRMeshBuilderTypes.h:13
length
Definition MRObjectDimensionsEnum.h:17
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Contour2f convertContourTo2f(const From &from)
Instantiate the templates when generating bindings.
Definition MRContour.h:132
Contours2d convertContoursTo2d(const From &from)
Definition MRContour.h:139
Contours2f convertContoursTo2f(const From &from)
Definition MRContour.h:137
Contours3f convertContoursTo3f(const From &from)
Definition MRContour.h:138
Contour3f convertContourTo3f(const From &from)
Definition MRContour.h:133
Contour2d convertContourTo2d(const From &from)
Definition MRContour.h:134
Contour3d convertContourTo3d(const From &from)
Definition MRContour.h:135
Contours3d convertContoursTo3d(const From &from)
Definition MRContour.h:140
Definition MRVector2.h:29
Definition MRVector3.h:33