Geometry - ConeGeometry
0. 구성
ConeGeometry는 생성인자로 다음과 같이 7개의 인자를 받는다
radius, height,radialSegments, heightSegments, openEnded,thetaStart,thetalLenght
1. 밑몉의 반지름
기본값은 1이다
_setupModel() {
const geometry = new THREE.ConeGeometry(); //1라디안은 180도/파이 , 즉 파이는 180도
const fillMaterial = new THREE.MeshPhongMaterial({ color: 0x515151 });
const cube = new THREE.Mesh(geometry, fillMaterial);
const lineMaterial = new THREE.LineBasicMaterial({ color: 0xffff00 });
const line = new THREE.LineSegments(
new THREE.WireframeGeometry(geometry),
lineMaterial
);
const group = new THREE.Group();
group.add(cube);
group.add(line);
this._scene.add(group);
this._cube = group;
}
0.5로 줄여보자
const geometry = new THREE.ConeGeometry(0.5);
2. 원뿔의 높이
기본값은 1이다
const geometry = new THREE.ConeGeometry(0.5);
1.2 로 변경해보자
const geometry = new THREE.ConeGeometry(0.5, 1.2);
3. 원뿔의 둘레방향에 대한 분할 개수
기본값은 32이다
10개로 바꿔보자
onst geometry = new THREE.ConeGeometry(0.5, 1.2, 10);
4. 원뿔의 높이방향에 대한 분할 개수
기본값은 1이다
4로 변경해보자
const geometry = new THREE.ConeGeometry(0.5, 1.2, 10, 4);
5. 밑면을 뚫을것인가?
기본값은 false이다
그래서 아래면이 막혀있는것을 확인할 수 있다
true를 줘보자
const geometry = new THREE.ConeGeometry(0.5, 1.2, 10, 4, true);
바닥이 뚫린 것을 확인할 수 있다
6. 시작각과 연장각
시작각은 0 연장각은 360도 가 기본값이다
6시에서 시작해서 90도만 연장시켜보자
const geometry = new THREE.ConeGeometry(
0.5,
1.2,
10,
4,
true,
Math.PI,
Math.PI / 2
);
반응형
'웹 개발 > 🧊 ThreeJS' 카테고리의 다른 글
Three.js | Geometry - SphereGeometry (0) | 2024.05.11 |
---|---|
Three.js | Geometry - CylinderGeometry (0) | 2024.05.06 |
Three.js | Geometry - CircleGeometry (0) | 2024.05.06 |
Three.js | Geometry - BoxGeometry (0) | 2024.05.06 |
Three.js | Geometry & OrbitControls (0) | 2024.05.06 |