本文整理汇总了C++中LineString::numSegments方法的典型用法代码示例。如果您正苦于以下问题:C++ LineString::numSegments方法的具体用法?C++ LineString::numSegments怎么用?C++ LineString::numSegments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LineString
的用法示例。
在下文中一共展示了LineString::numSegments方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: distanceLineStringLineString3D
double distanceLineStringLineString3D( const LineString& gA, const LineString& gB )
{
if ( gA.isEmpty() || gB.isEmpty() ) {
return std::numeric_limits< double >::infinity() ;
}
size_t nsA = gA.numSegments() ;
size_t nsB = gB.numSegments() ;
double dMin = std::numeric_limits< double >::infinity() ;
for ( size_t i = 0; i < nsA; i++ ) {
for ( size_t j = 0; j < nsB; j++ ) {
dMin = std::min(
dMin,
distanceSegmentSegment3D(
gA.pointN( i ), gA.pointN( i+1 ),
gB.pointN( j ), gB.pointN( j+1 )
)
) ;
}
}
return dMin ;
}
示例2: offset
/**
* @brief build LineString offset
*/
void offset( const LineString & lineString, const double& radius, Offset_polygon_set_2 & polygonSet ){
for ( size_t i = 0; i < lineString.numSegments(); i++ ){
Polygon_2 P ;
P.push_back( lineString.pointN(i).toPoint_2() );
P.push_back( lineString.pointN(i+1).toPoint_2() );
Offset_polygon_with_holes_2 offset = CGAL::approximated_offset_2( P, radius, SFCGAL_OFFSET_ACCURACY ) ;
if ( polygonSet.is_empty() ){
polygonSet.insert( offset );
}else{
polygonSet.join( offset );
}
}
}
示例3: distancePointLineString3D
double distancePointLineString3D( const Point& gA, const LineString& gB )
{
if ( gA.isEmpty() || gB.isEmpty() ) {
return std::numeric_limits< double >::infinity() ;
}
double dMin = std::numeric_limits< double >::infinity() ;
for ( size_t i = 0; i < gB.numSegments(); i++ ) {
dMin = std::min( dMin, distancePointSegment3D( gA, gB.pointN( i ), gB.pointN( i+1 ) ) );
}
return dMin ;
}
示例4: isCounterClockWiseOriented
bool isCounterClockWiseOriented( const LineString& ls )
{
// Compute the 'z' part of the Newell's formula
// and test against 0
Kernel::FT z = 0 ;
for ( size_t i = 0; i < ls.numSegments(); ++i ) {
const Point& pi = ls.pointN( i );
const Point& pj = ls.pointN( i+1 );
z += ( pi.x() - pj.x() ) * ( pi.y() + pj.y() );
}
return z > 0;
}
示例5: distanceLineStringTriangle3D
double distanceLineStringTriangle3D( const LineString& gA, const Triangle& gB )
{
if ( gA.isEmpty() || gB.isEmpty() ) {
return std::numeric_limits< double >::infinity() ;
}
double dMin = std::numeric_limits< double >::infinity() ;
const Point& tA = gB.vertex( 0 ) ;
const Point& tB = gB.vertex( 1 ) ;
const Point& tC = gB.vertex( 2 ) ;
for ( size_t i = 0; i < gA.numSegments(); i++ ) {
dMin = std::min( dMin, distanceSegmentTriangle3D( gA.pointN( i ), gA.pointN( i+1 ), tA, tB, tC ) );
}
return dMin ;
}