本文整理汇总了C++中LineString::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ LineString::isEmpty方法的具体用法?C++ LineString::isEmpty怎么用?C++ LineString::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LineString
的用法示例。
在下文中一共展示了LineString::isEmpty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: minkowskiSum
void minkowskiSum( const LineString& gA, const Polygon_2& gB, Polygon_set_2& polygonSet )
{
if ( gA.isEmpty() ) {
return ;
}
int npt = gA.numPoints() ;
for ( int i = 0; i < npt - 1 ; i++ ) {
Polygon_2 P;
P.push_back( gA.pointN( i ).toPoint_2() );
P.push_back( gA.pointN( i+1 ).toPoint_2() );
//
// We want to compute the "minkowski sum" on each segment of the line string
// This is not very well defined. But it appears CGAL supports it.
// However we must use the explicit "full convolution" method for that particular case in CGAL >= 4.7
#if CGAL_VERSION_NR < 1040701000 // version 4.7
Polygon_with_holes_2 part = minkowski_sum_2( P, gB );
#else
Polygon_with_holes_2 part = minkowski_sum_by_full_convolution_2( P, gB );
#endif
// merge into a polygon set
if ( polygonSet.is_empty() ) {
polygonSet.insert( part );
}
else {
polygonSet.join( part );
}
}
}
示例3: write
void WktWriter::write( const LineString & g )
{
_s << "LINESTRING" ;
if ( g.isEmpty() ){
_s << " EMPTY" ;
return ;
}
writeInner(g);
}
示例4: distanceLineStringPolygon3D
double distanceLineStringPolygon3D( const LineString& gA, const Polygon& gB )
{
if ( gA.isEmpty() || gB.isEmpty() ) {
return std::numeric_limits< double >::infinity() ;
}
TriangulatedSurface triangulateSurfaceB ;
triangulate::triangulatePolygon3D( gB, triangulateSurfaceB ) ;
return distanceGeometryCollectionToGeometry3D( triangulateSurfaceB, gA );
}
示例5: 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 ;
}
示例6: visit
void BoundaryVisitor::visit( const LineString& g )
{
if ( g.isEmpty() ) {
_boundary.reset();
return ;
}
if ( g.startPoint().coordinate() == g.endPoint().coordinate() ) {
_boundary.reset() ;
}
else {
std::auto_ptr< MultiPoint > boundary( new MultiPoint );
boundary->addGeometry( g.startPoint() );
boundary->addGeometry( g.endPoint() );
_boundary.reset( boundary.release() );
}
}
示例7: distanceLineStringSolid3D
double distanceLineStringSolid3D( const LineString& gA, const Solid& gB )
{
if ( gA.isEmpty() || gB.isEmpty() ) {
return std::numeric_limits< double >::infinity() ;
}
if ( intersects( gA, gB, NoValidityCheck() ) ) {
return 0.0 ;
}
double dMin = std::numeric_limits< double >::infinity() ;
for ( size_t i = 0; i < gB.numShells(); i++ ) {
dMin = std::min( dMin, gB.shellN( i ).distance3D( gA ) );
}
return dMin ;
}
示例8: 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 ;
}
示例9: minkowskiSum
void minkowskiSum( const LineString& gA, const Polygon_2 & gB, Polygon_set_2 & polygonSet ){
if ( gA.isEmpty() ){
return ;
}
int npt = gA.numPoints() ;
for ( int i = 0; i < npt - 1 ; i++ ){
Polygon_2 P;
P.push_back( gA.pointN(i).toPoint_2() );
P.push_back( gA.pointN(i+1).toPoint_2() );
Polygon_with_holes_2 part = minkowski_sum_2( P, gB );
// merge into a polygon set
if ( polygonSet.is_empty() ){
polygonSet.insert( part );
}else{
polygonSet.join( part );
}
}
}