Skip to content

Commit 47edaa8

Browse files
committed
3.1.1 Circle, cylinder...
1 parent 6c03a21 commit 47edaa8

File tree

1 file changed

+53
-8
lines changed

1 file changed

+53
-8
lines changed

Chapter3/3.1.1.html

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@
2020
// draw axes to help you understand the coordinate
2121
drawAxes(scene);
2222

23-
var material = /*[new THREE.MeshBasicMaterial({
24-
color: 0
25-
}), */new THREE.MeshBasicMaterial({
23+
var material = new THREE.MeshBasicMaterial({
2624
color: 0xffff00,
27-
wireframe: true,
28-
transparent: true
25+
wireframe: true
2926
});
3027

31-
//drawCube(scene, material);
28+
drawCube(scene, material);
3229
//drawPlane(scene, material);
33-
drawSphere(scene, material);
30+
//drawSphere(scene, material);
31+
//drawCircle(scene, material);
32+
//drawCylinder(scene, material);
33+
//drawTetra(scene, material);
34+
//drawOcta(scene, material);
35+
//drawIcosa(scene, material);
36+
//drawTorus(scene, material);
37+
//drawTorusKnot(scene, material);
3438

3539
// render
3640
renderer.render(scene, camera);
@@ -53,10 +57,51 @@
5357
// 0, Math.PI * 2, Math.PI / 6, Math.PI / 2), material);
5458
//var sphere = new THREE.Mesh(new THREE.SphereGeometry(3, 8, 6,
5559
// Math.PI / 2, Math.PI, Math.PI / 6, Math.PI / 2), material);
56-
sphere.flipSided = true;
5760
scene.add(sphere);
5861
}
5962

63+
function drawCircle(scene, material) {
64+
var circle = new THREE.Mesh(new THREE.CircleGeometry(3, 18, Math.PI / 3, Math.PI / 3 * 4), material);
65+
scene.add(circle);
66+
}
67+
68+
function drawCylinder(scene, material) {
69+
var cylinder = new THREE.Mesh(new THREE.CylinderGeometry(2, 2, 4, 18, 3), material);
70+
//var cylinder = new THREE.Mesh(new THREE.CylinderGeometry(2, 3, 4, 18, 3), material);
71+
//var cylinder = new THREE.Mesh(new THREE.CylinderGeometry(2, 3, 4, 18, 3, true), material);
72+
scene.add(cylinder);
73+
}
74+
75+
function drawTetra(scene, material) {
76+
var tetra = new THREE.Mesh(new THREE.TetrahedronGeometry(3), material);
77+
scene.add(tetra);
78+
}
79+
80+
function drawOcta(scene, material) {
81+
var octa = new THREE.Mesh(new THREE.OctahedronGeometry(3), material);
82+
scene.add(octa);
83+
}
84+
85+
function drawIcosa(scene, material) {
86+
var icosa = new THREE.Mesh(new THREE.IcosahedronGeometry(3), material);
87+
scene.add(icosa);
88+
}
89+
90+
function drawTorus(scene, material) {
91+
var torus = new THREE.Mesh(new THREE.TorusGeometry(3, 1, 4, 8, Math.PI / 3 * 2), material);
92+
scene.add(torus);
93+
}
94+
95+
function drawTorusKnot(scene, material) {
96+
var torus = new THREE.Mesh(new THREE.TorusKnotGeometry(2, 0.5, 32, 8), material);
97+
scene.add(torus);
98+
}
99+
100+
function drawTube(scene, material) {
101+
var tube = new THREE.Mesh(new THREE.TubeGeometry(1, 0.5), material);
102+
scene.add(tube);
103+
}
104+
60105
function drawAxes(scene) {
61106
// x-axis
62107
var xGeo = new THREE.Geometry();

0 commit comments

Comments
 (0)