【问题标题】:Three.js dashed circle三.js虚线圆圈
【发布时间】:2016-05-23 11:16:10
【问题描述】:

按照虚线的模式,我尝试了这个,但它没有给我一个虚线圆圈(并不奇怪)。

var dashMaterial = new THREE.LineDashedMaterial( { color: 0xee6666, dashSize: 0.5, gapSize: 0.5  } ),
circGeom = new THREE.CircleGeometry( 10, 20 );
circGeom.computeLineDistances();
circGeom.vertices.shift();
var circ = new THREE.Line( circGeom, dashMaterial);
scene.add( circ );

如何在 Three.js 中构造虚线圆?

【问题讨论】:

    标签: javascript three.js


    【解决方案1】:

    你必须在移除中心顶点后计算顶点之间的距离:

    circGeom.computeLineDistances();
    circGeom.vertices.shift();
    

    =>

    circGeom.vertices.shift();
    circGeom.computeLineDistances();
    

    [https://jsfiddle.net/fs904hon/]

    【讨论】:

    • 您的结果看起来有点奇怪。线条似乎有点扭曲。你确定结果正确吗?
    • 我的结果回答了主题启动器的问题:为什么他显示的代码没有显示虚线圆圈。当然,如果我们玩以下参数:圆的段数,虚线配置,我们可以得到更好的结果[jsfiddle.net/56sqt3rq]
    • 谢谢,stdob。第二把小提琴中的设置效果很好。看来我还不能投票给你的答案,但谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多