Class: Laser::Cutter::Sloped::RingPanel

Inherits:
Object
  • Object
show all
Defined in:
lib/laser/cutter/sloped/ring_panel.rb

Overview

One of the rectangular panels that wrap around the sloped box between its two side walls: the bottom, the back, a strip or the tilted panel.

In its own frame the panel is width along x, from one side wall to the other, and length along y, from its near edge to its far edge.

    far edge
3 +----------+ 2
  |          |
end |          | end
  |          |
0 +----------+ 1
    near edge
  • A long edge is notched into the panel beyond it, or plain.
  • An end is notched into the side wall from the near edge as far as joint, and from there on covers the edge of the side wall, one thickness out. A strip ends that way, past the corner of the wall, and so does a tilted panel that lifts off, along its whole length.
  • A corner next to two notched edges may carry the corner cube.

Constant Summary collapse

OUTWARDS =

Which way is out of the panel across its left end, near edge, right end and far edge. Corner n lies between entry n and the one after.

[[-1, 0], [0, -1], [1, 0], [0, 1]].freeze

Instance Method Summary collapse

Constructor Details

#initialize(notcher:, width:, length:, joint:, near: nil, far: nil, corners: []) ⇒ RingPanel

Returns a new instance of RingPanel.

Parameters:

  • notcher (Notcher)
  • width (Numeric) —

    between the side walls

  • length (Numeric) —

    from the near edge to the far edge

  • near (Boolean, nil) (defaults to: nil) —

    the middle notch of the near edge: true for a tab, false for a hole, nil for a plain edge

  • far (Boolean, nil) (defaults to: nil) —

    the same, for the far edge

  • joint (Numeric) —

    how far along each end, from the near edge, the notches into the side wall run

  • corners (Array<Symbol>) (defaults to: []) —

    the edges whose two corners this panel carries: :near, :far



38
39
40
41
42
43
44
45
46
47
# File 'lib/laser/cutter/sloped/ring_panel.rb', line 38

def initialize(notcher:, width:, length:, joint:, near: nil, far: nil, corners: [])
  @notcher = notcher
  @width = width.to_f
  @length = length.to_f
  @joint = joint.to_f
  @near = near
  @far = far
  @corners = corners
  freeze
end

Instance Method Details

#loop ⇒ Geometry::Loop

Returns the outline, counter-clockwise from the near left corner.

Returns:

  • (Geometry::Loop) —

    the outline, counter-clockwise from the near left corner



50
51
52
# File 'lib/laser/cutter/sloped/ring_panel.rb', line 50

def loop
  Geometry::Loop.new(near_edge + corner(1) + right_end + corner(2) + far_edge + corner(3) + left_end + corner(0))
end