0
我有這樣幾點:繪製弧形three.js所
"POLYLINE":[[
{"x":"-6094.1665707632401","y":"3074.764386330728","r":""},
{"x":"-699.22595358468595","y":"1099.941236568309","r":""},
{"x":"-4940.397089330264","y":"576.87996358328382","r":""},
{"x":"-1329.5259580814709","y":"3149.4874087018579","r":"0.5163456475719181"},
{"x":"-6094.1665707632401","y":"3074.764386330728","r":""}
]]
其中x y是一個折線和r的頂點爲半徑,如果它是一個弧形。 我可以管理繪製的是,如果這個心不是可能的,但我需要跳過去弧腳本
function DRAWpline(vert){
vert = JSON.parse(vert);
var material = new THREE.LineBasicMaterial({
color: 0x0000ff
});
var geometry = new THREE.Geometry();
for (var i = 0; i < vert.length; i++) {
if(vert[i]['r'] != ""){
geometry.vertices.push(new THREE.Vector3(vert[i]['x'], vert[i]['y'], 0));
} else {
}
}
var line = new THREE.Line(geometry, material);
scene.add(line);
}
Oups,重新閱讀您的帖子後。我想我誤解你了。當r被定義爲X時,Y是弧的起點還是弧的中心?如果它是中心,我的代碼是不正確的 – Troopers
再次感謝芽!我從來沒有參加過數學課,我退學了,所以我很難與這個觸發器,而不是什麼。我最終使用了一個函數來合併幾何圖形在完成後發佈代碼。 – contehhh
嘿,你可以仔細檢查這段代碼嗎?我實現了它,它將弧線放在目標位置 – contehhh