Skip to content

Latest commit

 

History

History
57 lines (49 loc) · 1.21 KB

0313.md

File metadata and controls

57 lines (49 loc) · 1.21 KB

3D Shapes

  • Box, sphere, torus

Box

  • Defining points: verticies
  • Givens: P0 (top-left-front), width (x), height (y), depth (z)

Sphere (x-rotation)

  • Defining points: points along the surface
  • Givens: center, radius
  • Generate a sphere by rotating a circle
x = rcosθ + cx
y = rsinθcosΦ + cy
z = rsinθsinΦ + cz
[1  0     0  ]   [rcosθ]   [rcosθ    ]
[0 cosΦ -sinΦ] x [rsinθ] = [rsinθcosΦ]
[0 sinΦ  cosΦ]   [  θ  ]   [rsinθsinΦ]

θ: angle of circle creation Φ: angle of circle rotation

θ: 0 -> 2π, Φ: 0 -> π

OR

θ: 0-> π, Φ: 0 -> 2π
for Φ: 0 -> 2π
  for θ: 0 -> π
    x = rcosθ + cx
    y = rsinθcosΦ + cy
    z = rsinθsinΦ + cz

Torus

  • Defining points: points on surface
  • Givens: r (radius of generating circle), R (radius of torus - r), cx, cy, cz
  • Generate the points by translating a circle and then rotating
  • If we translate over x, rotate about y
  • If we translate over y, rotate about x

y-rotation x circle* = torus

[cosΦ  0 sinΦ]   [rcosθ + R]   [cosΦ(rcosθ + R) + cx]
[0     1   0 ] x [  rsinθ  ] = [rsinθ + cy]
[-sinΦ 0 cosΦ]   [    0    ]   [-sinΦ(rcosθ + R) + cz]

θ: 0 -> 2π Φ: 0 -> 2π