当前位置:网站首页>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)
边栏推荐
- Hundreds of lines of code to implement a script interpreter
- Metartc5.0 API programming guide (I)
- Project practice! Teach you JMeter performance test hand in hand
- 【牛客网刷题系列 之 Verilog快速入门】~ 四选一多路器
- LeetCode 88:合并两个有序数组
- The number of small stores in Suning has dropped sharply by 428 in one year. Zhangkangyang, the son of Zhang Jindong, is the actual controller
- 基于订单流工具,我们能看到什么?
- PMP考试成绩多久出来?这些你务必知道!
- Biovendor sRAGE protein solution
- Role of native keyword
猜你喜欢
CpG solid support research: lumiprobe general CpG type II
吴恩达深度学习测验题:deeplearning.ai-week1-quiz
Simulation questions and answers of the latest national fire-fighting facility operators (primary fire-fighting facility operators) in 2022
[noip2002 popularization group] cross the river pawn
[JVM series] JVM tuning
cgo+gSoap+onvif学习总结:8、arm平台交叉编译运行及常见问题总结
Where does the storm go? Whose pot is the weather forecast wrong?
Reactive dye research: lumiprobe af594 NHS ester, 5-isomer
Role of native keyword
How to do a good job of gateway high availability protection in the big promotion scenario
随机推荐
整理网上蛋糕商城项目
开关电源电压型与电流型控制
wordpress zibll子比主题6.4.1开心版 免授权
[NOIP2002 普及组] 过河卒
Organize the online cake mall project
JS text box loses focus to modify width text and symbols
Audio and video technology development weekly
PCR/qPCR研究:Lumiprobe丨dsGreen 用于实时 PCR
2022高处安装、维护、拆除考试题及答案
2022年G3锅炉水处理复训题库模拟考试平台操作
Unity out ref params
How high is the gold content of grade II cost engineer certificate? Just look at this
【JVM系列】JVM调优
[CSP-J2020] 优秀的拆分
高通平台 Camera 之 MCLK 配置
程序员-放羊娃
A guide to P2P network penetration (stun) for metartc5.0 programming
2022西式面点师(高级)考试试题模拟考试平台操作
Leetcode 88: merge two ordered arrays
通过例子学习Rust