国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁(yè) > news >正文

優(yōu)化企業(yè)網(wǎng)站標(biāo)題河北百度競(jìng)價(jià)優(yōu)化

優(yōu)化企業(yè)網(wǎng)站標(biāo)題,河北百度競(jìng)價(jià)優(yōu)化,網(wǎng)站維護(hù)會(huì)關(guān)閉嗎,php mysql怎么編寫(xiě)視頻網(wǎng)站boost::Geometry boost作為C中最常用的第三方庫(kù),Geometry庫(kù)里面擁有大量的開(kāi)源算法。 函數(shù)作用get獲取幾何圖形(通常為點(diǎn))的坐標(biāo)值get (with index)獲取框或段的坐標(biāo)值set設(shè)置幾何圖形(通常為點(diǎn))的坐標(biāo)值set (with i…

boost::Geometry

boost作為C++中最常用的第三方庫(kù),Geometry庫(kù)里面擁有大量的開(kāi)源算法。

函數(shù)作用
get獲取幾何圖形(通常為點(diǎn))的坐標(biāo)值
get (with index)獲取框或段的坐標(biāo)值
set設(shè)置幾何圖形(通常為點(diǎn))的坐標(biāo)值
set (with index)設(shè)置Box / Segment的坐標(biāo)值
exterior_ring獲取多邊形的外接多邊形
interior_rings獲取多邊形的內(nèi)接多邊形
bg::model::polygon<point> poly;
bg::exterior_ring(poly) = boost::assign::tuple_list_of(0, 0)(0, 3)(3, 3)(3, 0)(0, 0);bg::model::polygon<point> poly;
bg::interior_rings(poly) = boost::assign::tuple_list_of(0, 0)(0, 3)(3, 3)(3, 0)(0, 0);

Boost.Array:適用于 Boost.Geometry中不同的點(diǎn)類(lèi)型
Boost.Fusion:自定義不同的點(diǎn)的結(jié)構(gòu)并適配 Boost.Geometry點(diǎn)的處理方法,因此,可以調(diào)用許多Boost.Geometry算法
Boost.Tuple:組成的點(diǎn)集也可以使用算術(shù)運(yùn)算,元素可以用作 Boost.Geometry 內(nèi)部的點(diǎn)

Boost.Polygon

函數(shù)作用
point_dataBoost.Polygon點(diǎn)類(lèi)型(boost::polygon::point_data)
rectangle_dataBoost.Polygon矩形類(lèi)型
polygon_dataBoost.Polygon多邊形類(lèi)型
polygon_with_holes_dataBoost.Polygon多邊形類(lèi)型

Boost.Range

函數(shù)作用
filtered過(guò)濾不符合條件的數(shù)據(jù)
reversed反轉(zhuǎn)數(shù)據(jù)
sliced指定在數(shù)據(jù)中切出一定部分的數(shù)據(jù)
strided指定在數(shù)據(jù)以n為步長(zhǎng)間接取值

area

函數(shù)作用
area計(jì)算幾何圖形的面積
area (with strategy)使用指定的策略計(jì)算幾何圖形的面積

assign

函數(shù)作用
assign將一個(gè)幾何圖形指定給另一個(gè)幾何圖元
assign_inverse利用assign_ inverse和expand方便地確定兩點(diǎn)的邊界三維框
assign_points為 linestring, ring 或 polygon指定一系列點(diǎn)
assign_values為幾何圖形指定兩個(gè)坐標(biāo)(通常為二維點(diǎn),三維點(diǎn)和四維點(diǎn)這三種情況)
assign_zeroassign_zero函數(shù)初始化坐標(biāo)為零的二維或三維點(diǎn)或框
append將一個(gè)或多個(gè)點(diǎn)附加到linestring, ring, polygon, multi-geometry中

buffer

自由函數(shù)緩沖區(qū)計(jì)算幾何體的緩沖區(qū)(多邊形是距離幾何體指定最大距離內(nèi)的空間點(diǎn)集集合)。下圖顯示了策略在生成的緩沖區(qū)中的作用

return_buffer
return_ buffer函數(shù)計(jì)算幾何體的緩沖區(qū)(多邊形是距離幾何體指定最大距離內(nèi)的空間點(diǎn)集集合)。這個(gè)帶有return_前綴的版本返回緩沖區(qū),因此必須在調(diào)用中指定模板參數(shù)。這個(gè)個(gè)人感覺(jué)功能性沒(méi)有buffer好

centroid

centroid
使用指定的策略計(jì)算幾何圖形的質(zhì)心

return_centroid
使用指定的策略計(jì)算幾何圖形的質(zhì)心。這兩個(gè)求質(zhì)心的方式類(lèi)似。

Densify

線段插值

vector<Point2f> Densify(const Segment2f& seg, int num) {CHECK_GT(num, 0);CHECK(!bg::intersects(seg.s, seg.e));vector<Point2f> pts{seg.s};pts.reserve(num);boost::geometry::line_interpolate(seg, bg::length(seg) / num, pts);pts.emplace_back(seg.e);return pts;
}

部分函數(shù)

函數(shù)作用
clear清除 linestring, ring 或者 polygon (exterior+interiors) 和 multi*
convert將一個(gè)幾何圖形轉(zhuǎn)換為另一個(gè)幾何圖元
convex_hull計(jì)算幾何體的凸包
correct糾正幾何圖形:所有相對(duì)于其預(yù)期方向錯(cuò)誤定向的環(huán)都將反轉(zhuǎn)。對(duì)于所有沒(méi)有閉點(diǎn)且按其應(yīng)有類(lèi)型鍵入的環(huán),將附加第一個(gè)點(diǎn)。也可以校正框。
covered_by使用指定的策略檢查第一個(gè)幾何圖形是否位于第二個(gè)幾何圖形的內(nèi)部或邊界上
crosses檢查兩個(gè)幾何圖形是否相交
densify使用指定的策略加密幾何體
difference計(jì)算兩種幾何圖形的差異.通過(guò)差分計(jì)算兩種幾何的空間集合論差分
discrete_frechet_distance使用指定的策略計(jì)算兩個(gè)幾何圖形之間的離散Frechet距離(目前適用于LineString)
discrete_hausdorff_distance使用指定的策略計(jì)算兩個(gè)幾何圖形之間的離散Hausdorff距離(目前適用于 LineString-LineString, MultiPoint-MultiPoint, Point-MultiPoint, MultiLineString-MultiLineString)
disjoint檢查兩個(gè)幾何圖形是否不相交
equals檢查幾何體在空間上是否相等
expand使用長(zhǎng)方體來(lái)框選多個(gè)幾何圖形(長(zhǎng)方體、點(diǎn))的邊界框
intersection計(jì)算兩個(gè)幾何圖形的交點(diǎn)
intersects檢查幾何圖形是否至少有一個(gè)交點(diǎn)(相交或自相切)
is_empty檢查幾何圖形是否為空集
is_simple檢查幾何圖形是否簡(jiǎn)單
is_valid檢查幾何圖形是否有效(在OGC意義上)
length函數(shù)長(zhǎng)度計(jì)算幾何體的長(zhǎng)度(連續(xù)點(diǎn)之間的距離之和)。它使用基于幾何體坐標(biāo)系的默認(rèn)策略。
line_interpolate返回沿LineString方向插值的一個(gè)或多個(gè)點(diǎn)
make構(gòu)造幾何圖形
make_inverse用逆無(wú)窮坐標(biāo)構(gòu)造一個(gè)長(zhǎng)方體
make_zero構(gòu)造一個(gè)坐標(biāo)初始化為零的幾何體
num_geometries計(jì)算幾何圖形的幾何圖形數(shù)
num_interior_rings計(jì)算幾何圖形的內(nèi)解多邊形數(shù)
num_points計(jì)算幾何圖形的點(diǎn)數(shù)
num_segments計(jì)算幾何圖形的線段數(shù)(segments)
overlaps檢查兩個(gè)幾何圖形是否重疊
perimeter計(jì)算幾何圖形的周長(zhǎng)
relate檢查由遮罩定義的一對(duì)幾何圖形之間的關(guān)系
relation計(jì)算DE-9IM中定義的一對(duì)幾何圖形之間的關(guān)系
reverse反轉(zhuǎn)幾何圖形中的點(diǎn)
simplify簡(jiǎn)化幾何圖形
sym_difference計(jì)算兩種幾何體的對(duì)稱(chēng)差
touches檢查幾何圖形是否至少有一個(gè)接觸點(diǎn)(自相切)
transform使用策略從一個(gè)幾何圖形轉(zhuǎn)換到另一個(gè)幾何圖元
union_組合兩個(gè)相互關(guān)聯(lián)的幾何圖形
unique計(jì)算幾何圖形的最小集
within檢查第一個(gè)幾何體是否完全位于第二個(gè)幾何體內(nèi)部

distance

comparable_distance
使用指定的策略計(jì)算兩個(gè)幾何圖形的可比距離測(cè)量值,點(diǎn)在多邊形內(nèi)部,可以使用comparable_distance

double cmpDst = boost::geometry::comparable_distance(segment,pt);

distance
使用指定的策略計(jì)算兩個(gè)幾何圖形之間的距離。distance可以正確處理多邊形外部的點(diǎn),但是似乎將多邊形視為實(shí)體。因此,多邊形內(nèi)的每個(gè)點(diǎn)到多邊形的距離顯然為0。

double cmpDst = boost::geometry::distance(segment,pt);

envelope

envelope
自由函數(shù)包絡(luò)計(jì)算幾何體的包絡(luò)(也稱(chēng)為軸對(duì)齊邊界框、aabb或最小邊界矩形、mbr)

return_envelope
自由函數(shù)return_envelope計(jì)算幾何體的包絡(luò)(也稱(chēng)為軸對(duì)齊邊界框、aabb或最小邊界矩形、mbr)。這個(gè)帶有return_前綴的版本返回信封,因此必須在調(diào)用中指定模板參數(shù)

點(diǎn)云處理

函數(shù)作用
add_point將一個(gè)點(diǎn)添加到另一個(gè)點(diǎn)
add_value將相同的值添加到點(diǎn)的每個(gè)坐標(biāo)
assign_point用另一個(gè)點(diǎn)指定一個(gè)點(diǎn)
assign_value為點(diǎn)的每個(gè)坐標(biāo)指定相同的值
cross_product計(jì)算兩個(gè)向量的叉積
divide_point將一點(diǎn)除以另一點(diǎn)
divide_value將同一點(diǎn)的每個(gè)坐標(biāo)除以一個(gè)值
dot_product計(jì)算2個(gè)矢量(點(diǎn))的點(diǎn)積(或標(biāo)量積)
multiply_point將一個(gè)點(diǎn)乘以另一個(gè)點(diǎn)
multiply_value將點(diǎn)的每個(gè)坐標(biāo)乘以相同的值
subtract_point將一點(diǎn)減去另一點(diǎn)
subtract_value將相同的值減去點(diǎn)的每個(gè)坐標(biāo)

常數(shù)控制

函數(shù)作用
min_corner指示要獲取、設(shè)置或處理的框的最小角
max_corner指示要獲取、設(shè)置或處理的框的最大角

坐標(biāo)系轉(zhuǎn)換

函數(shù)作用
cs::cartesian笛卡爾坐標(biāo)系
cs::spherical球面(極坐標(biāo))坐標(biāo)系,以度或弧度表示
cs::spherical_equatorial球面赤道坐標(biāo)系,以度或弧度表示
cs::geographic地理坐標(biāo)系,以度或弧度表示

核心元函數(shù)

函數(shù)作用
closure將值定義為指定幾何圖形類(lèi)型的閉包(順時(shí)針、逆時(shí)針)的函數(shù)
coordinate_system函數(shù)將類(lèi)型定義為構(gòu)成指定幾何類(lèi)型的點(diǎn)類(lèi)型的坐標(biāo)系(笛卡爾坐標(biāo)系、球面坐標(biāo)系等)
coordinate_type函數(shù)將類(lèi)型定義為構(gòu)成指定幾何類(lèi)型的點(diǎn)類(lèi)型的坐標(biāo)類(lèi)型(int、float、double等)
cs_tag函數(shù)返回任意幾何體的坐標(biāo)系標(biāo)記(cs族)
degree定義球面坐標(biāo)系的平面角單位的標(biāo)記。此標(biāo)記指定坐標(biāo)的定義單位為度(-180…180)。必須為某些坐標(biāo)系指定它
dimension將值定義為構(gòu)成指定幾何圖形類(lèi)型的點(diǎn)類(lèi)型的函數(shù)
interior_type將類(lèi)型定義為指定幾何類(lèi)型的interior_ type(內(nèi)環(huán)的容器類(lèi)型)的函數(shù)
point_order將值定義為指定幾何圖形類(lèi)型的點(diǎn)順序(順時(shí)針、逆時(shí)針)的函數(shù)
point_type將類(lèi)型定義為指定幾何體類(lèi)型的point_ type的元函數(shù)
radian平面角單位:弧度
ring_type將類(lèi)型定義為指定幾何體類(lèi)型的環(huán)_類(lèi)型的函數(shù)
tag將類(lèi)型定義為指定幾何體類(lèi)型的標(biāo)記的函數(shù)
tag_cast標(biāo)記轉(zhuǎn)換,標(biāo)記可以相互繼承。例如,multi_ point繼承multi_。通常,行為可以在不同的幾何圖形類(lèi)型之間共享。由metafunction標(biāo)記找到的標(biāo)記可以轉(zhuǎn)換為更基本的標(biāo)記,然后由該標(biāo)記分派

模型

函數(shù)作用
model::point基點(diǎn)類(lèi),具有以中性方式定義的坐標(biāo)
model::d2::point_xy笛卡爾坐標(biāo)系中的二維點(diǎn)
model::d3::point_xyz笛卡爾坐標(biāo)系中的三維點(diǎn)
model::linestringlinestring(由OGC命名)是點(diǎn)的集合(默認(rèn)為向量)
model::polygon多邊形包含一個(gè)外圈和零個(gè)或多個(gè)內(nèi)圈
model::multi_pointmulti_point,點(diǎn)的集合
model::multi_linestringmulti_line,linestring的集合
model::multi_polygonmulti_ polygon,多邊形的集合
model::box類(lèi)框:定義由兩個(gè)描述點(diǎn)組成的框
model::ring環(huán)(也稱(chēng)為線性環(huán))是一條不應(yīng)自相交的閉合線
model::segment在幾何學(xué)中,線段是由兩個(gè)不同端點(diǎn)限定的直線的一部分,包含其端點(diǎn)之間直線上的每個(gè)點(diǎn)
model::referring_segment類(lèi)段:包含兩個(gè)(模板化)點(diǎn)引用的小類(lèi)

空間索引

boost::geometry::index::rtree

函數(shù)作用
rtree()rtree的構(gòu)造函數(shù)
~rtree()rtree的析構(gòu)函數(shù)
operator=(rtree const &)賦值運(yùn)算符
swap(rtree &)交換兩個(gè)RTree的內(nèi)容
insert(value_type const &)在索引中插入一個(gè)值
remove(value_type const &)從容器中刪除值
query(Predicates const &, OutIter)此查詢函數(shù)執(zhí)行空間和k近鄰搜索。它允許傳遞一組數(shù)據(jù)。僅當(dāng)滿足所有數(shù)據(jù)時(shí)才會(huì)返回值
qbegin(Predicates const &)返回指向查詢范圍開(kāi)頭的查詢迭代器
qend()返回一個(gè)指向查詢范圍末尾的查詢迭代器
begin()返回指向rtree值范圍開(kāi)頭的迭代器
end()返回指向rtree值范圍末尾的迭代器
size()返回存儲(chǔ)值的數(shù)目
empty()查詢?nèi)萜魇欠駷榭?/td>
clear()刪除存儲(chǔ)在容器中的所有值
bounds()返回能夠包含容器中存儲(chǔ)的所有值的框
count(ValueOrIndexable const &)對(duì)于indexable_type,它返回可索引的值的數(shù)目等于參數(shù)。對(duì)于value_type,它返回等于參數(shù)的值的數(shù)量
parameters()返回參數(shù)
indexable_get()返回從值檢索可索引的函數(shù)
value_eq()返回比較值的函數(shù)
get_allocator()返回rtree使用的分配器

R-tree parameters (boost::geometry::index)

函數(shù)作用
boost::geometry::index::linear線性r樹(shù)創(chuàng)建算法參數(shù)
boost::geometry::index::quadratic二次r樹(shù)生成算法參數(shù)
boost::geometry::index::rstarR*-樹(shù)創(chuàng)建算法參數(shù)
boost::geometry::index::dynamic_linear線性r樹(shù)創(chuàng)建算法參數(shù)-運(yùn)行時(shí)版本
boost::geometry::index::dynamic_quadratic二次r樹(shù)創(chuàng)建算法參數(shù)-運(yùn)行時(shí)版本
boost::geometry::index::dynamic_rstarR*-樹(shù)創(chuàng)建算法參數(shù)-運(yùn)行時(shí)版本

其他函數(shù)

函數(shù)作用
boost::geometry::index::indexable從值中提取可索引的函數(shù)對(duì)象,這個(gè)是override轉(zhuǎn)換
boost::geometry::index::equal_to函數(shù)對(duì)象比較值,這個(gè)是override轉(zhuǎn)換
inserter(Container &)插入迭代器生成器,這個(gè)是override轉(zhuǎn)換
queried(Predicates const &)查詢索引適配器生成器

Predicates (boost::geometry::index)

Predicates (boost::geometry::index) 下面的這些都是與前文同名函數(shù)相同的意思,只是是適用于RTree的函數(shù)

函數(shù)
contains(Geometry const &)
covered_by(Geometry const &)
covers(Geometry const &)
disjoint(Geometry const &)
intersects(Geometry const &)
overlaps(Geometry const &)
within(Geometry const &)
satisfies(UnaryPredicate const &)
nearest(Geometry const &, unsigned)

Geometry策略方式

函數(shù)作用
strategy::area::cartesian笛卡爾面積計(jì)算
strategy::area::spherical球面面積計(jì)算
strategy::area::geographic地理區(qū)域計(jì)算
strategy::buffer::join_round讓緩沖區(qū)創(chuàng)建圓角
strategy::buffer::join_miter讓緩沖區(qū)創(chuàng)建銳角
strategy::buffer::end_round讓緩沖區(qū)創(chuàng)建圓角端點(diǎn)
strategy::buffer::end_flat讓緩沖區(qū)創(chuàng)建平端
strategy::buffer::distance_symmetric讓緩沖區(qū)算法創(chuàng)建具有相同距離的緩沖區(qū)
strategy::buffer::distance_asymmetric讓緩沖區(qū)是不對(duì)稱(chēng)
strategy::buffer::point_circle圍繞點(diǎn)創(chuàng)建圓形緩沖區(qū)
strategy::buffer::point_square圍繞點(diǎn)創(chuàng)建方形緩沖區(qū)
strategy::buffer::geographic_point_circle在地球上的一個(gè)點(diǎn)周?chē)鷦?chuàng)建一個(gè)圓形緩沖區(qū)
strategy::buffer::side_straight讓緩沖區(qū)沿線段使用直邊(默認(rèn))
strategy::centroid::average質(zhì)心計(jì)算取點(diǎn)的平均值
strategy::centroid::bashein_detmer使用Bashein/Detmer算法計(jì)算質(zhì)心
strategy::convex_hull::graham_andrewGraham掃描策略計(jì)算凸包
strategy::densify::cartesian笛卡爾線段的致密化
strategy::densify::geographic地理段的致密化,對(duì)應(yīng)了上文的densify方法
strategy::densify::spherical球形段的致密化,對(duì)應(yīng)了上文的densify方法
strategy::distance::pythagoras計(jì)算兩點(diǎn)之間距離的策略,對(duì)應(yīng)了上文的distance方法
strategy::distance::pythagoras_box_box計(jì)算兩個(gè)盒子之間距離的策略,對(duì)應(yīng)了上文的distance方法
strategy::distance::pythagoras_point_box計(jì)算點(diǎn)與長(zhǎng)方體之間距離的策略,對(duì)應(yīng)了上文的distance方法
strategy::distance::haversine使用哈弗斯線計(jì)算完美球體上球坐標(biāo)的距離
strategy::distance::projected_point點(diǎn)到線段的距離策略
strategy::distance::cross_track用于點(diǎn)到線段距離計(jì)算的策略函數(shù)
strategy::distance::cross_track_point_box用于計(jì)算點(diǎn)到框的距離的策略函數(shù)
strategy::line_interpolate::cartesian在笛卡爾線段上插值點(diǎn),對(duì)應(yīng)了上文的line_interpolate方法
strategy::line_interpolate::geographic插值地理線段上的點(diǎn),對(duì)應(yīng)了上文的line_interpolate方法
strategy::line_interpolate::spherical在球面段上插值點(diǎn),對(duì)應(yīng)了上文的line_interpolate方法
strategy::side::side_by_triangle檢查點(diǎn)位于線段的哪一側(cè):線段左側(cè)(>0),線段右側(cè)(<0),線段上(0)
strategy::side::side_by_cross_track檢查大圓線段的哪一側(cè)有一個(gè)點(diǎn)位于線段左側(cè)(>0),線段右側(cè)(<0),線段(0)
strategy::side::spherical_side_formula檢查大圓線段的哪一側(cè)有一個(gè)點(diǎn)位于線段左側(cè)(>0),線段右側(cè)(<0),線段(0)上
strategy::side::geographic檢查線段的哪一側(cè)有一個(gè)點(diǎn)位于線段左側(cè)(>0)、右側(cè)(<0)和線段(0)上
strategy::simplify::douglas_peucker實(shí)現(xiàn)簡(jiǎn)化算法
strategy::transform::inverse_transformer在笛卡爾坐標(biāo)系中進(jìn)行逆變換的變換策略
strategy::transform::map_transformer從一個(gè)笛卡爾坐標(biāo)系映射到另一個(gè)笛卡兒坐標(biāo)系的轉(zhuǎn)換策略
strategy::transform::rotate_transformer笛卡爾坐標(biāo)系中的旋轉(zhuǎn)變換策略
strategy::transform::scale_transformer笛卡爾系統(tǒng)中的尺度變換策略
strategy::transform::translate_transformer笛卡爾系統(tǒng)中的平移變換策略
strategy::transform::matrix_transformer笛卡爾系統(tǒng)中的仿射變換策略
strategy::within::winding在使用纏繞規(guī)則的檢測(cè)范圍內(nèi)。根據(jù)點(diǎn)的坐標(biāo)系選擇內(nèi)部使用的邊策略。
strategy::within::franklin在使用交叉計(jì)數(shù)的檢測(cè)范圍內(nèi)
strategy::within::crossings_multiply在使用交叉計(jì)數(shù)的檢測(cè)范圍內(nèi)

示例

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/foreach.hpp>
#include <boost/assign/list_of.hpp>
namespace bg = boost::geometry;
typedef bg::model::d2::point_xy<double> Point;
typedef bg::model::segment<Point> Segment;
typedef bg::model::linestring<Point> LineString;
typedef bg::model::box<Point> Box;
typedef bg::model::ring<Point, false> Ring;
typedef bg::model::polygon<Point, false> Polygon;int main()
{Point pt0(100, 100);Point pt1(200, 200);Segment sg0(pt0, pt1);double Distance = 0;//1、點(diǎn)到點(diǎn)的距離Distance = bg::distance(pt0, pt1);  // 141.421//2、點(diǎn)到線段的距離,如果點(diǎn)到直線的垂足不在線段上,所計(jì)算的距離為(點(diǎn)到直線的距離、線段到垂足延長(zhǎng)的距離之和)Distance = bg::distance(Point(200, 100), sg0);  // 70.7107Distance = bg::distance(Point(100, 0), sg0);    // 100//3、判斷線段是否相交Segment sg1(Point(0, 100), Point(100, 0));Segment sg2(Point(100, 200), Point(200, 100));bool bIntersect = false;bIntersect = bg::intersects(sg0, sg1);  // 0bIntersect = bg::intersects(sg0, sg2);  // 1//4、求線段與線段的交點(diǎn)std::list<Point> lstPoints;bg::intersection(sg0, sg1, lstPoints);lstPoints.clear();bg::intersection(sg0, sg2, lstPoints);  // (150, 150)//5、判斷box是否相交Box rc(Point(0, 0), Point(200, 200));Box rc0(Point(250, 250), Point(450, 450));Box rc1(Point(100, 100), Point(300, 300));bIntersect = bg::intersects(rc, rc0);   // 0bIntersect = bg::intersects(rc, rc1);   // 1//6、判斷box是否與LineString相交LineString line0;line0.push_back(Point(10, 250));line0.push_back(Point(100, 100));line0.push_back(Point(120, -10));line0.push_back(Point(210, 200));bIntersect = bg::intersects(rc, line0);     // 1bIntersect = bg::intersects(rc0, line0);    // 0//7、求box與linestring的交點(diǎn)std::list<LineString> lstLines;bg::intersection(rc, line0, lstLines);  // (40, 200),(100, 100),(118.18, 0), (124, 0),(200, 176.67)//8、點(diǎn)是否在box內(nèi)Box rc7(Point(0, 0), Point(100, 100));bool bInside = false;bInside = bg::within(Point(50, 50), rc7);   // 1bInside = bg::within(Point(0, 0), rc7);     // 0//9、判斷LineString與LineString是否相交LineString line1, line2, line3;line1.push_back(Point(50, 50));line1.push_back(Point(150, 50));line1.push_back(Point(50, 200));line1.push_back(Point(150, 200));line2.push_back(Point(100, 0));line2.push_back(Point(70, 100));line2.push_back(Point(150, 210));line3.push_back(Point(200, 0));line3.push_back(Point(200, 200));bIntersect = bg::intersects(line1, line2);  // 1bIntersect = bg::intersects(line1, line3);  // 0//10、求LineString與LineString的交點(diǎn)lstPoints.clear();bg::intersection(line1, line2, lstPoints);  // (85, 50), (94.35, 133.48), (142.72, 200)lstPoints.clear();bg::intersection(line1, line3, lstPoints);//11、判斷ring與ring是否相交Point arDPoint0[6] = {Point(0, 0), Point(100, 0), Point(200, 100), Point(100, 200), Point(0, 200), Point(0, 0)};Point arDPoint1[6] = {Point(100, 100), Point(200, 0), Point(300, 0), Point(300, 200), Point(200, 200), Point(100, 100)};Ring r0(arDPoint0, arDPoint0 + 6);Ring r1(arDPoint1, arDPoint1 + 6);bIntersect = bg::intersects(r0, r1);    // 1//12、求ring與ring的交點(diǎn)lstPoints.clear();bg::intersection(r0, r1, lstPoints);    // (150, 30), (150, 150)Polygon poly1;Polygon poly2;Polygon poly3;auto lstOf = boost::assign::list_of(Point(0, 0))(Point(200, 0))(Point(200, 200))(Point(0, 200))(Point(0, 0));poly1.outer().assign(lstOf.begin(), lstOf.end());lstOf = boost::assign::list_of(Point(50, 50))(Point(150, 50))(Point(150, 150))(Point(50, 150))(Point(50, 50));poly1.inners().push_back(lstOf);lstOf = boost::assign::list_of(Point(100, 0))(Point(120, 0))(Point(120, 200))(Point(100, 200))(Point(100, 0));poly2.outer().assign(lstOf.begin(), lstOf.end());lstOf = boost::assign::list_of(Point(100, 60))(Point(120, 60))(Point(120, 140))(Point(100, 140))(Point(100, 60));poly3.outer().assign(lstOf.begin(), lstOf.end());//13、判斷polygon與polygon是否相交bIntersect = bg::intersects(poly1, poly2);  // 1bIntersect = bg::intersects(poly1, poly3);  // 0//14、求polygon與polygon相交的區(qū)域std::list<Polygon> lstPolygon;bg::intersection(poly1, poly2, lstPolygon);lstPolygon.clear();bg::intersection(poly1, poly3, lstPolygon);//15、判斷點(diǎn)是否在polygon內(nèi)bInside = bg::within(Point(100, 100), poly1);   // 0bInside = bg::within(Point(25, 25), poly1);     // 1return 0;
}
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/foreach.hpp>
#include <boost/assign/list_of.hpp>int main()
{typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon;polygon green, blue;boost::geometry::read_wkt("POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)""(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))", green);boost::geometry::read_wkt("POLYGON((4.0 -0.5 , 3.5 1.0 , 2.0 1.5 , 3.5 2.0 , 4.0 3.5 , 4.5 2.0 , 6.0 1.5 , 4.5 1.0 , 4.0 -0.5))", blue);std::deque<polygon> output;boost::geometry::intersection(green, blue, output);int i = 0;std::cout << "green && blue:" << std::endl;BOOST_FOREACH(polygon const& p, output){std::cout << i++ << ": " << boost::geometry::area(p) << std::endl;  // 0: 2.50205}return 0;
}
http://m.aloenet.com.cn/news/40255.html

相關(guān)文章:

  • 備案網(wǎng)站制作北京百度關(guān)鍵詞推廣
  • 企業(yè)注冊(cè)在哪個(gè)網(wǎng)站申請(qǐng)網(wǎng)絡(luò)營(yíng)銷(xiāo)的發(fā)展現(xiàn)狀及趨勢(shì)
  • 合肥公司網(wǎng)站建設(shè)搜索引擎優(yōu)化排名seo
  • 在上面網(wǎng)站上可以做統(tǒng)計(jì)圖今日深圳新聞最新消息
  • 長(zhǎng)沙專(zhuān)業(yè)網(wǎng)站設(shè)計(jì)平臺(tái)高質(zhì)量軟文
  • 音樂(lè)外鏈網(wǎng)站網(wǎng)站推廣引流最快方法
  • 設(shè)計(jì)素材網(wǎng)站0百度認(rèn)證怎么認(rèn)證
  • 旅行社門(mén)店做網(wǎng)站嘛營(yíng)銷(xiāo)文案
  • 推廣網(wǎng)站排名優(yōu)化seo教程福州seo優(yōu)化
  • 盤(pán)縣做會(huì)計(jì)兼職的網(wǎng)站愛(ài)站網(wǎng)關(guān)鍵詞密度
  • 做網(wǎng)站有效果嗎揚(yáng)州整站seo
  • 江西響應(yīng)式網(wǎng)頁(yè)建設(shè)沙洋縣seo優(yōu)化排名價(jià)格
  • 教程網(wǎng)站搭建優(yōu)化網(wǎng)站快速排名軟件
  • 天津百度優(yōu)化武漢seo認(rèn)可搜點(diǎn)網(wǎng)絡(luò)
  • 公司做網(wǎng)站賣(mài)東西要什么證太原網(wǎng)站制作優(yōu)化seo公司
  • 網(wǎng)頁(yè)設(shè)計(jì)實(shí)訓(xùn)報(bào)告工作內(nèi)容和步驟長(zhǎng)春網(wǎng)站建設(shè)方案優(yōu)化
  • 自己做的網(wǎng)站怎么賺錢(qián)嗎百度推廣助手客戶端
  • 大豐網(wǎng)站建設(shè)新東方教育培訓(xùn)機(jī)構(gòu)官網(wǎng)
  • 新余做網(wǎng)站公司培訓(xùn)班報(bào)名
  • 網(wǎng)站開(kāi)發(fā)所需技能北京seo優(yōu)化廠家
  • 公司網(wǎng)站建設(shè)做分錄谷歌seo顧問(wèn)
  • php網(wǎng)站的部署愛(ài)站網(wǎng)站長(zhǎng)seo綜合查詢工具
  • 機(jī)械公司網(wǎng)站建設(shè)中國(guó)法律服務(wù)網(wǎng)app最新下載
  • wordpress 圖片 分離seo研究所
  • wordpress3.1.3漏洞企業(yè)網(wǎng)站seo案例
  • 牛牛襄陽(yáng)網(wǎng)站建設(shè)大數(shù)據(jù)營(yíng)銷(xiāo)系統(tǒng)軟件
  • 商城小程序報(bào)價(jià)廊坊關(guān)鍵詞優(yōu)化報(bào)價(jià)
  • 安卓做網(wǎng)站教程個(gè)人網(wǎng)頁(yè)制作成品
  • 怎么做日本釣魚(yú)網(wǎng)站嗎關(guān)鍵詞優(yōu)化和seo
  • 專(zhuān)業(yè) 網(wǎng)站設(shè)計(jì)公司php開(kāi)源建站系統(tǒng)