THREEJS案例-坐标系之点线面
Posted 开源编程案例
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了THREEJS案例-坐标系之点线面相关的知识,希望对你有一定的参考价值。
画线
function createLine(lineColor,points) {
var material = new THREE.LineBasicMaterial({
color: lineColor
});
var geometry = new THREE.Geometry();
geometry.vertices=points;
var line = new THREE.Line(geometry, material, THREE.LineSegments);
scene.add(line);
return line;
}
//调用
createLine(0x00FF00, [new THREE.Vector3(0, 0, 0), new THREE.Vector3(500, 0, 0)]);
画面
ThreeJS平面扫盲连接:
https://threejs.org/docs/index.html#api/zh/geometries/PlaneGeometry
function createShape(){
var geometry = new THREE.PlaneGeometry( 500, 300, 32 );
var material = new THREE.MeshBasicMaterial( {color: 0xE1FFFF} );
var plane = new THREE.Mesh( geometry, material );
plane.position.set(250,150,0);
scene.add( plane );
}
文字
ThreeJS文字扫盲连接:
https://threejs.org/docs/index.html#api/zh/geometries/TextGeometry
function createText(text,x,y,z,c){
var loader = new THREE.FontLoader();
//可以在 C:\Windows\Fonts 下面找到中文字体库,用下面的链接转换
//http://gero3.github.io/facetype.js/
loader.load( './css/fonts/helvetiker_regular.typeface.json', function ( font ) {
var geometry = new THREE.TextGeometry( text, {
font: font,
size: 30,
height: 10,
curveSegments: 3,
bevelEnabled: true,
bevelThickness: 3,
bevelSize: 3,
bevelSegments: 5
} );
var material = new THREE.MeshBasicMaterial( {color: c} );
var xMesh = new THREE.Mesh( geometry, material );
xMesh.position.set(x,y,z);
scene.add( xMesh );
} );
}
以上是关于THREEJS案例-坐标系之点线面的主要内容,如果未能解决你的问题,请参考以下文章
ArcGIS实验教程——实验四十五:坐标直接转点线面案例教程(Create Features From Text File)
ArcGIS风暴如何将矢量数据(点线面)折点坐标转为GeoJSON格式?
ArcGIS风暴如何将矢量数据(点线面)折点坐标转为GeoJSON格式?