当前位置:网站首页>cesium 区域裁剪、局部渲染
cesium 区域裁剪、局部渲染
2022-07-16 09:27:00 【mmm_morning】
实现如题功能,需要用到cesium的ClippingPlaneCollection与ClippingPlane接口。其中ClippingPlane用于定义裁剪平面,ClippingPlaneCollection则是ClippingPlane的集合。一般来说,我们需要多个裁剪面的协作配合才能实现理想的效果。
ClippingPlaneCollection的使用
new Cesium.ClippingPlaneCollection({
modelMatrix: entity.computeModelMatrix(Cesium.JulianDate.now()),
planes: [
new Cesium.ClippingPlane(
new Cesium.Cartesian3(1.0, 0.0, 0.0),
-700.0
),
new Cesium.ClippingPlane(
new Cesium.Cartesian3(-1.0, 0.0, 0.0),
-700.0
),
new Cesium.ClippingPlane(
new Cesium.Cartesian3(0.0, 1.0, 0.0),
-700.0
),
new Cesium.ClippingPlane(
new Cesium.Cartesian3(0.0, -1.0, 0.0),
-700.0
),
],
edgeWidth: edgeStylingEnabled ? 1.0 : 0.0,
edgeColor: Cesium.Color.WHITE,
enabled: clippingPlanesEnabled,
});
globe.backFaceCulling = true;
globe.showSkirts = true;
viewer.trackedEntity = entity;
}
上述代码是cesium沙盒中的例子,参数 modelMatrix为裁剪面集合的模型矩阵,要想定位到自定义位置,其值应为
Cesium.Transforms.eastNorthUpToFixedFrame(position)//将坐标原点移至当前位置
参数planes为ClippingPlane的集合,后续讲解
globe.backFaceCulling = true;
globe.showSkirts = true;
这俩参数的作用好像对本功能没啥影响,有了解的小伙伴还请不吝赐教。
ClippingPlane的使用
ClippingPlane有两个参数
new Cesium.ClippingPlane(normal, distance)
第一个参数为裁剪面的归一化法向量,第二个参数为坐标原点距离裁剪面的最短距离。距离符号决定原点位于平面的哪一侧。如果距离为正,原点位于法线方向的半空间中;如果为负,原点位于法线对面的半空间中;如果为零,则平面穿过原点。
应用如下裁剪面
planes: [
new Cesium.ClippingPlane(
new Cesium.Cartesian3(1.0, 0.0, 0.0),
distance
),
new Cesium.ClippingPlane(
new Cesium.Cartesian3(-1.0, 0.0, 0.0),
distance
),
new Cesium.ClippingPlane(
new Cesium.Cartesian3(0.0, 1.0, 0.0),
distance
),
new Cesium.ClippingPlane(
new Cesium.Cartesian3(0.0, -1.0, 0.0),
distance
)
其中 const distance = 3000.0
实现的裁剪效果如图
此例仅是简单的矩形区域裁剪,若需完成不规则形状的裁剪,利用微分思想多选取几个点,逐一计算裁剪面归一化法向量即可。
附上沙盒链接
边栏推荐
- NFT trading platform competition pattern: what is the core competitiveness?
- What is EOC
- 数据库系统原理与应用教程(020)—— 登录 MySQL
- Sydtek Internship (I): 4K and ble profile burning
- 【生物信息】影像组学入门实践成长营
- 7.14二分,LCA,差分,思维构造
- Elk cluster deployment (II) deployment kibana
- Learning notes - DC motor governor
- 【生物信息学】外泌体miRNA成长训练营(14天)
- 基于GPU加速的Opencv库 & 利用cmake和vs2019重新配置并生成Opencv-cuda版本
猜你喜欢
![[vsctf2022]web topic recurrence](/img/6f/56a9ec14ec699e427e9e21ee48c9eb.png)
[vsctf2022]web topic recurrence

JS variable points you don't know

What are the key smart contracts in defi?

Fosai biology interprets the changes in the atmospheric environment in the first half of 2022, and VOCs control is still the key to breaking the situation

Full decentralization of social networks

CF609A USB Flash Drives

How to extract value from the working capital pool by using impermanent losses

Irregular area of OSPF

1388. 3n 块披萨 动态规划

NFT players' consensus segmentation: money, community and culture
随机推荐
A collection of dichotomous (dichotomous answers) questions
HCIP PPP/HDLC、GRE/MGRE实验
Assist developers to comprehensively interpret APIs IX test cases
数据库系统原理与应用教程(020)—— 登录 MySQL
7.14二分,LCA,差分,思维构造
PC网页、移动端适配,页面font-size动态变化
7.13 learning records
[binary tree] all elements in two binary search trees
CF609A USB Flash Drives
Leetcode question brushing record 17
容器健康检查解析
FPGA 20个例程篇:8.SD卡任意地址的读写
[vsctf2022]web topic recurrence
Learning notes - DC motor governor
Joint autoregressive and hierarchical priorities for learned image compression
OSPF的5个数据包、LSA信息
leetcode刷题记录17
各国程序员薪资水平,咱有点惨...
Sword finger offer 10- I. Fibonacci sequence (4 solutions)
HCIP - PPP/HDLC与GRE/MGRE实验