分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

threejs 画二维圆(圆弧)

发布时间:2023-09-06 01:37责任编辑:蔡小小关键词:js
画圆:
var radius = 40,
segments = 64,
material = new THREE.LineBasicMaterial({ color: 0x0000ff }),
geometry = new THREE.CircleGeometry(radius, segments);

???????// Remove center vertex
???????geometry.vertices.shift();

???????this.scene.add(new THREE.Line(geometry, material));
 
使用THREE.Line会导致最后一点和第一点未链接,可用
this.scene.add(new THREE.LineLoop(geometry, material));
 
 
画圆也可用(该方法可自行设置画圆弧)
let points = [],
length = 100,
circle = 40;
for (let i = 0; i <= length; i++) {
  points.push(new THREE.Vector2(circle * Math.cos(Math.PI * 2 * i / length), circle * Math.sin(Math.PI * 2 * i / length)))
}
let shape = new THREE.Shape(points);
let arcGeometry = shape.makeGeometry()
let arcMaterial = new THREE.LineBasicMaterial({ color: 0x38d3f5 });
let arc = new THREE.Line(arcGeometry, arcMaterial);
this.scene.add(arc)
注:该方法画圆最后无法闭合

threejs 画二维圆(圆弧)

原文地址:https://www.cnblogs.com/brainworld/p/8297995.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved