Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
IdahoEv committed Nov 29, 2011
1 parent 485dc83 commit 2089e2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
10 changes: 7 additions & 3 deletions construct.lua
Expand Up @@ -46,11 +46,15 @@ function Construct:initialize(
y = math.sin((s-1) * angle_subtended) * self.radius }
local stop = { x = math.cos(s * angle_subtended) * self.radius,
y = math.sin(s * angle_subtended) * self.radius }
-- Walk out the points of the face in clockwise fashion

-- Walk out the points of the face in counterclockwise fashion
-- counterclockwise so that a cross product of (p2-p1 X p3-p1)
-- will give us a proper outward-facing normal.
local p1 = matrix{ start.x, start.y, half_height }
local p2 = matrix{ stop.x, stop.y, half_height }
local p2 = matrix{ start.x, start.y, -half_height }
local p3 = matrix{ stop.x, stop.y, -half_height }
local p4 = matrix{ start.x, start.y, -half_height }
local p4 = matrix{ stop.x, stop.y, half_height }

local faces = { { p1, p2, p3, p4 } }
segment = Segment:new(self, faces)
segment:rotateInitialFaces(rot_matrix)
Expand Down
14 changes: 10 additions & 4 deletions initialize_solar_system.lua
Expand Up @@ -27,10 +27,16 @@ sol.paintable = PaintableStar:new(sol, { R = 255, G = 255, B = 225 })
sol:setOrbitalRadius(0)
sol:setOrbitalPeriod(1)

local ring2 = Construct:new(sol, 20, EARTH_ORBIT_RADIUS*2, EARTH_ORBIT_RADIUS, 10,
500 * SECONDS_PER_DAY, matrix:new{ .3, .3, 1 })
ring2.name = "Asteroids?"
ring2.paintable = PaintableConstruct:new(ring2, { R = 200, G = 100, B = 100 })
local niven_ring = Construct:new(sol,
30,
EARTH_ORBIT_RADIUS * 2.5,
EARTH_ORBIT_RADIUS * .5, -- cylinder height, km
10, -- cylinder thickness, km
500 * SECONDS_PER_DAY,
matrix:new{ .5, .5, 1 }
)
niven_ring.name = "Niven Ring"
niven_ring.paintable = PaintableConstruct:new(niven_ring, { R = 200, G = 100, B = 100 })

local kiri = Spob:new(sol) -- kiri
kiri.name = "Kiri"
Expand Down

0 comments on commit 2089e2a

Please sign in to comment.