Geometry

Geometry

3D ๊ณต๊ฐ„ ๋‚ด์˜ x์ถ•, y์ถ•, z์ถ•์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌผ์ฒด์˜ ์œ„์น˜, ํฌ๊ธฐ, ๋ชจ์–‘ ๋“ฑ์„ ํ‘œํ˜„ํ•˜๊ธฐ ์œ„ํ•œ ์ˆ˜ํ•™์ ์ธ ๊ตฌ์กฐ์™€ ์›๋ฆฌ

Segments

  • Geometry๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ์—ฌ๋Ÿฌ ์‚ผ๊ฐํ˜• ์กฐ๊ฐ์œผ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค.

  • Segments๋Š” geometry๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์ž‘์€ ์‚ผ๊ฐํ˜•๋“ค์„ ์˜๋ฏธํ•˜๋ฉฐ, ๊ตฌ์„ฑ๋œ segments๊ฐ€ ๋งŽ์•„์งˆ์ˆ˜๋ก ๋ณด๋‹ค ๋†’์€ ๋””ํ…Œ์ผ๊ณผ ๋ถ€๋“œ๋Ÿฌ์šด ์™ธํ˜•์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๊ฒŒ๋œ๋‹ค.

  • ๋‹จ, ๋ Œ๋”๋ง ์‹œ segements์˜ ์ˆ˜๊ฐ€ ๋งŽ์•„์งˆ์ˆ˜๋ก ๊ณ„์‚ฐ๋Ÿ‰์ด ๋งŽ์•„์ง€๋ฏ€๋กœ ์„ฑ๋Šฅ ์ €ํ•˜๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋‹ค.

Built In Geometry

Three.js์—์„œ ์ œ๊ณตํ•˜๋Š” ๋‹ค์–‘ํ•œ Geometry๋ฅผ ์•Œ์•„๋ณด์ž.

  • BoxGeometry โ†’ ํ๋ธŒ ๋ชจ์–‘์˜ ํ˜•ํƒœ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ, width, height, depth์™€ ๊ฐ๊ฐ์˜ segments๋กœ ๊ตฌ์„ฑ๋œ๋‹ค.

  • CapsuleGeometry โ†’ ์บก์Š ๋ชจ์–‘์˜ ํ˜•ํƒœ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ, radius,length, ๊ฐ๊ฐ์˜ segement๋กœ ๊ตฌ์„ฑ๋œ๋‹ค.

  • CircleGeometry โ†’ ์›ํŒ ๋ชจ์–‘์˜ ํ˜•ํƒœ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ, radius, segments ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค.

  • ConeGeometry โ†’ ๊ฐ๋ฟ” ๋˜๋Š” ์›๋ฟ” ๋ชจ์–‘์˜ ํ˜•ํƒœ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ, radius, height, segments๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ, openEnded ์˜ต์…˜์œผ๋กœ ๋ฐ‘๋ฉด์ด ๋šซ๋ฆผ ์—ฌ๋ถ€๋ฅผ ์กฐ์ ˆ ๊ฐ€๋Šฅ

  • EdgesGeometry โ†’ ๋‹ค๋ฅธ ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ์˜ ๋ชจ์„œ๋ฆฌ ์˜์—ญ์„ ํ‘œํ˜„ํ•ด์ฃผ๋Š” ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ

  • IcosahedronGeometry โ†’ 20๋ฉด์ฒด๋ฅผ ๋งŒ๋“ค ๋•Œ ์‚ฌ์šฉ๋˜๋Š” ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ, radius,detail ๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ detail ๊ฐ’์ด ์ปค์งˆ์ˆ˜๋ก ๊ตฌ์˜ ํ˜•ํƒœ์— ๊ฐ€๊นŒ์›Œ ์ง€๊ฒŒ ๋œ๋‹ค.

  • PlaneGeometry โ†’ ํ‰๋ฉด์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ, ๋ฐ”๋‹ฅ์„ ํ‘œํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ์ž์ฃผ ์‚ฌ์šฉ๋œ๋‹ค.

  • RingGeometry โ†’ ๋ง ๋ชจ์–‘์˜ ํ˜•ํƒœ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ

  • ShapeGeometry -> ์‚ฌ์šฉํ•  ๋งˆ๋•…ํ•  ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ๊ฐ€ ์—†๊ณ , ์›ํ•˜๋Š” ํ˜•ํƒœ์˜ ๋„ํ˜•์„ ์ง์ ‘ ์ปค์Šคํ…€ํ•˜๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค.

  • SphereGeometry -> ๊ตฌ ํ˜•ํƒœ์˜ ์ง€์˜ค๋ฉ”ํŠธ๋ฆฌ, ๋‹ฌ๊ณผ ํ–‰์„ฑ์„ ํ‘œํ˜„ํ•  ๋•Œ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉ๋œ๋‹ค.

Shape

const shpae = new THREE.Shpae();
const geometry = new THREE.ShapeGeometry(shape);

Method

absarc(absolute arc)

  • (x, y, radius, startAngle, endAngle, clockwise)

  • ํƒ€์› ๋ชจ์–‘์˜ ๊ณก์„ ์„ ๊ทธ๋ฆฌ๋Š”๋ฐ ์‚ฌ์šฉ๋œ๋‹ค.

  • ์›ํ˜ธ๋ฅผ ๋œปํ•˜๋Š” arc๋Š” '๊ณก์„ ์˜ ํ•œ ๋ถ€๋ถ„'์„ ์˜๋ฏธํ•œ๋‹ค.

  • ShapeGeometry๋Š” 2์ฐจ์› ๋„ํ˜•๋งŒ์„ ๋‚˜ํƒ€๋‚ด๋Š”๋ฐ ๊นŠ์ด๊ฐ์„ ํ‘œํ˜„ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ExtrudeGeometry๋ฅผ ์‚ฌ์šฉํ•˜์ž.

// ์˜ˆ์‹œ
const shape = new THREE.Shape();
shape
  .absarc(x, y, radius, Math.PI / 2, 0, true)
  .lineTo(x + radius, -y)
  .absarc(x, -y, radius, 0, -Math.PI / 2, true) 
  .lineTo(-x, -(y + radius))
  .absarc(-x, -y, radius, -Math.PI / 2, Math.PI, true)
  .lineTo(-(x + radius), y)
  .absarc(-x, y, radius, Math.PI, Math.PI / 2, true);

const geometry = new THREE.ExtrudeGeometry(shape, {
  depth: 0.01,
  bevelThickness: 0.1,
  });

Last updated