如何在地球上绘制国家/地区名称,以便使网格与曲面对齐 [英] How to plot country names on the globe, so the mesh will be aligned with the surfaces

查看:75
本文介绍了如何在地球上绘制国家/地区名称,以便使网格与曲面对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试绘制地球的国家/地区名称,因此文本网格将与表面对齐,但是我无法计算适当的旋转度.对于文本,我正在使用THREE.TextGeometry.该名称使用射线投射在相交点的国家网格的单击上显示.我缺乏如何将这些坐标转换为适当的旋转角度的知识.我不会发布我的代码,因为它完全是一团糟,我相信对于一个知识渊博的人来说,通常更容易解释如何实现此目标.

I'm trying to plot country names of the globe, so the text meshes will be aligned with the surface, but I'm failing to calculate proper rotations. For text I'm using THREE.TextGeometry. The name appears on the click of the mesh of the country at the point of intersection using raycasting. I'm lacking knowledge of how to turn these coordinates to proper rotation angles. I'm not posting my code, as it's complete mess and I believe for a knowldgeable person will be easier to explain how to achieve this in general.

这是理想的结果:

推荐答案

非常有趣的问题.我已经尝试过这种方式,可以将文本视为平面.让我们从球体中心(或位置)定义法线向量n,以指向要显示文本的球体表面上的点.我有一个简单的方法来使法线向量正确. 1.将文本网格放置在球体中心. text.position.copy(sphere.position) 2.使文本指向球体表面上的点,text.lookAt(point) 3.将文本定位到该点. text.position.copy(point)

very interesting question.I have tried this way, we can regard the text as a plane. lets define a normal vector n from your sphere center(or position) to point on the sphere surface where you want to display text. I have a simple way to make normal vector right. 1. put the text mesh on sphere center. text.position.copy(sphere.position) 2. make text to the point on sphere surface, text.lookAt(point) 3.relocate text to the point. text.position.copy(point)

这篇关于如何在地球上绘制国家/地区名称,以便使网格与曲面对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆