three.js 에서는 다양한 내장 Geometries를 제공합니다.
BoxGeometry (상자)
BoxGeometry는 세 가지 주요 차원(너비, 높이, 깊이)을 기반으로 상자 모양의 기하학객체를 생성하는 데 사용됩니다. 인자없이 생성하면 기본값의 정육면체가 만들어지죠. 인자는 총 6개이며, 인자 모두 선택사항이고, 기본값 1을 가집니다. BoxGeometry는 BufferGeometry클래스를 기반으로 하고 있습니다.
- width : 너비
- height 높이
- deeps 깊이
- widthSegments :너비 세그먼트 수
- heightSegments :높이 세그먼트 수
- depthSegments :깊이 세그먼트 수
*widthSegments :면의 너비값에 따라 분할된 직사각형 면의 수.
//const boxGeometry = new THREE.BoxGeometry() 인자를 안넣으면 기본값 1:1:1 정육면체가 만들어진다.
const boxGeometry = new THREE.BoxGeometry(1,2,3,4,5,6)
// 인자 순서대로 너비, 높이 , 깊이, 상자 지오메트리의 너비, 높이 및 깊이의 세그먼트 수를 지정
const material = new THREE.MeshBasicMaterial({
color: 0x00ff00,
wireframe: true,
})
const cube = new THREE.Mesh(boxGeometry, material)
scene.add(cube)
//생략
SphereGeometry (구)
SphereGeometry는 구 형태의 기하학 객체를 생성하는 클래스입니다.
const geometry = new THREE.SphereGeometry(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength);
- radius: 구의 반지름. (기본값 :1)
- widthSegments: 구의 가로(segment) 세그먼트 수. (최소값: 3, 기본값:32)
- heightSegments: 구의 세로(segment) 세그먼트 수. (최소값: 2, 기본값: 16)
- phiStart: phi 각(수평각)의 시작 각도 (기본값: 0).
- phiLength: phi 각(수평각)의 범위 크기 (기본값: Math.PI * 2).
- thetaStart: theta 각(수직각)의 시작 각도 (기본값: 0).
- thetaLength: theta 각(수직각)의 범위 크기(기본값: Math.PI).
IcosahedronGeometry(이코사헤드론)
IcosahedronGeometry는 20개의 삼각형 면을 가지는 고정된 구조의 다면체인 icosahedron(이코사헤드론)을 기하 모델링 클래스입니다. 이 다면체는 12개의 정점을 가지며 각 면은 삼각형으로 구성되어 있습니다.
const geometry = new THREE.IcosahedronGeometry(radius, detail);
- radius: 반지름.
- detail: 정밀도. 0 이상의 정수로 지정. 값이 높아질수록 더 많은 삼각형이 생성되어 부드러운 표면이 됨. (기본값: 0)
출처
https://sbcode.net/threejs/geometries/#srcclientclientts
Geometries - Three.js Tutorials
Special Offer Zabbix Monitoring Course Discount $11.99 https://www.udemy.com/course/zabbix-monitoring/?couponCode=607976806882D016D221 Offer expires in hours. Be quick and share with your friends and colleagues. Geometries Video Lecture Your browser does n
sbcode.net
'three.js' 카테고리의 다른 글
[React] Three.js 적용하기 (1) | 2023.10.12 |
---|---|
Local & World Transform과 object를 변형하는 4 가지 속성 (0) | 2023.09.25 |
유용한 Stats.js과 dat.gui 적용하기 (0) | 2023.09.23 |
Three.js 예제 코드로 기본 구조 파악하기 (1) | 2023.09.21 |
Three.js 프로젝트 세팅하기 with TS (0) | 2023.09.20 |