当前位置:网站首页>SlicePlane的Heading角度与Math.atan2(y,x)的对应转换关系
SlicePlane的Heading角度与Math.atan2(y,x)的对应转换关系
2022-06-28 05:05:00 【Higer2008】
对三维模型提进行剖切,想同时有多个剖切面(类似于连井剖面),查API构造SlicePlane可以实现,但在heading这个参数设置时遇到了一些麻烦,这里记录下,供大家参考。
想多个面剖切,需根据多个节点构造剖切面即SlicePlane,该面的构造需要如下参数:中心点,tilt(俯仰角),width,height和heading(我称之为航向角),示意图如上,代码如下:
let sliceWidget = new Slice({
view: view
});
sliceWidget.viewModel.shape = new SlicePlane({
position: new Point({
latitude: 34.06007911204149,
longitude: -117.1867758409791,
z: 416.852
}),
// a 30 degree angle between the slice plane and the ground plane
tilt: 30,
width: 32,
height: 32,
// the height axis of the plane is oriented north
heading: 0
});
sliceWidget.viewModel.start();
view.ui.add(sliceWidget, "top-right");
构造完毕后,按照如下代码,添加到Sceneview的analyses里即可。当然每次添加前可以先调用removeAll()方法清空。
// Adds an analysis to the View
view.analyses.add(lineOfSightAnalysis);
// Removes an analysis from the View
view.analyses.remove(lineOfSightAnalysis);
在构造时根据选点P1和P2计算width,heading参数,在计算heading参数时,本人使用的是Math.atan2(y,x),因两者对角度的定义,起算点,顺逆方向不一致,需要进行转换才能得出对应的正确角度,传递给SlicePlane的构造函数。经测试,不同象限的转换关系如下:
Math.atan2(y,x)是以弧度为单位
heading是以degree为单位的
- 将第一个点视为原点,当第二个点相对于第一个点位于一、四象限时,
heading = - atan2(p2.y-p1.y,p2.x-p1.x)/(Math.pi/180) - 将第一个点视为原点,当第二个点相对于第一个点位于二、三象限时,
heading = 180 - atan2(p2.y-p1.y,p2.x-p1.x)/(Math.pi/180)

边栏推荐
- 分享一个因子挖掘的利器:遗传规划
- 为什么大厂不让使用undefined
- 使用class toplevel的messagebox时,窗口弹出问题。
- 深度强化学习笔记
- 2022烟花爆竹经营单位安全管理人员特种作业证考试题库及模拟考试
- Light collector, Yunnan Baiyao!
- Excel将一行的内容进行复制时,列与列之间是用制表符“\t”进行分隔的
- Meta universe standard forum established
- How high is the gold content of grade II cost engineer certificate? Just look at this
- RxSwift --(1)创建一个项目
猜你喜欢

Flexible IP network test tool -- x-launch

Audio and video technology development weekly
![[csp-j2020] excellent splitting](/img/05/90f9cf71791b3cdc37073eaf5db989.png)
[csp-j2020] excellent splitting

交流电和直流电的区别是什么?

PCR/qPCR研究:Lumiprobe丨dsGreen 用于实时 PCR

Function and working principle of controller

Binary sort tree: BST
![[noip2002 popularization group] cross the river pawn](/img/6c/31fa210e08c7fd07691a1c5320154e.png)
[noip2002 popularization group] cross the river pawn

Generate QR code in wechat applet

Have you finished the examination of level II cost engineer? There are also qualification regulations!
随机推荐
店铺进销存管理系统源码
2022年安全员-A证考试题库及模拟考试
quartus 复制IP核
openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
Learn Taiji Maker - mqtt Chapter 2 (IV) esp8266 reserved message application
Realizing color detection with OpenCV
RxSwift --(1)创建一个项目
Standard particle swarm optimization C language program
Unity delegate
氨基染料研究:Lumiprobe FAM 胺,6-异构体
信息学奥赛一本通 1360:奇怪的电梯(lift)
2022电力电缆判断题模拟考试平台操作
判断对象中是否存在某一个属性
Binary sort tree: BST
S32ds jump to defaultisr
CI & CD must be known!
如何从零设计一款牛逼的高并发架构(建议收藏)
Severe tire damage: the first rock band in the world to broadcast live on the Internet
2022年G3锅炉水处理复训题库模拟考试平台操作
Don't roll! How to reproduce a paper with high quality?