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