第15回からこれまで,
立方体の頂点をワイヤーフレームで結ぶ
今回書くコードは,
第17回コード2では,
一辺の半分の長さから8頂点座標
var points;
var angle = 0; // Math.PI / 36;
function initialize() {
// points = createStarPoints(5, 65, 25);
points = createCubePoints(50);
}
/*
function createStarPoints(numVertices, longRadius, shortRadius) {
}
*/
function createCubePoints(halfEdge) {
var cubePoints = [
new Point3D(-halfEdge, -halfEdge, -halfEdge),
new Point3D(halfEdge, -halfEdge, -halfEdge),
new Point3D(halfEdge, halfEdge, -halfEdge),
new Point3D(-halfEdge, halfEdge, -halfEdge),
new Point3D(-halfEdge, -halfEdge, halfEdge),
new Point3D(halfEdge, -halfEdge, halfEdge),
new Point3D(halfEdge, halfEdge, halfEdge),
new Point3D(-halfEdge, halfEdge, halfEdge)
];
return cubePoints;
}
この書替えだけで,