Class: Voxel4r::VoxelGraph
- Inherits:
-
Object
- Object
- Voxel4r::VoxelGraph
- Defined in:
- lib/voxel4r.rb
Instance Method Summary collapse
- #drawVoxelGraph ⇒ Object
-
#initialize(data, unitary_length, theta) ⇒ VoxelGraph
constructor
A new instance of VoxelGraph.
Constructor Details
#initialize(data, unitary_length, theta) ⇒ VoxelGraph
Returns a new instance of VoxelGraph.
9 10 11 12 13 14 15 |
# File 'lib/voxel4r.rb', line 9 def initialize(data, unitary_length, theta) @edge_length = unitary_length @data = data @theta = theta compute_dimensions! end |
Instance Method Details
#drawVoxelGraph ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/voxel4r.rb', line 17 def drawVoxelGraph lines = [] # Join vertices @data.each do |v| flb = compute_2d_flb_point(v) voxel_edges = compute_voxel_edges(flb[0],flb[1]) voxel_edges.each { |l| lines << l } end # Draw lines in SVG image img = Rasem::SVGImage.new(@width, @height) do lines.each { |l| line l[0], l[1], l[2], l[3] } end img end |