radmesh 0.98.1 → 0.98.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RADMesh
4
+ VERSION = '0.98.2'.freeze
5
+ end
data/radmesh.gemspec CHANGED
@@ -1,7 +1,9 @@
1
+ # coding: utf-8
2
+ require File.expand_path('../lib/radmesh/version', __FILE__)
3
+
1
4
  Gem::Specification.new do |s|
2
5
  s.name = 'radmesh'
3
- s.version = '0.98.1'
4
- s.date = Time.now.strftime('%Y-%m-%d')
6
+ s.version = RADMesh::VERSION
5
7
  s.summary = 'Ruby wrapper around ADMesh'
6
8
  s.description = <<-eof
7
9
  ADMesh is a library for processing triangulated solid meshes.
@@ -13,7 +15,7 @@ Gem::Specification.new do |s|
13
15
  s.authors = ['Miro Hrončok']
14
16
  s.email = 'miro@hroncok.cz'
15
17
  s.files = Dir.glob('{doc,lib,spec}/**/*') +
16
- ['README.md', 'LICENSE', 'Rakefile', 'Gemfile', 'block.stl', __FILE__]
18
+ ['README.md', 'LICENSE', 'Rakefile', 'Gemfile', __FILE__]
17
19
  s.homepage =
18
20
  'https://github.com/admesh/rubygem-admesh'
19
21
  s.platform = Gem::Platform::RUBY
File without changes
data/spec/radmesh_spec.rb CHANGED
@@ -3,8 +3,10 @@ require 'minitest/autorun'
3
3
  require 'radmesh'
4
4
 
5
5
  describe RADMesh::STL do
6
+ STL_FILE = File.expand_path('../fixtures/block.stl', __FILE__)
7
+
6
8
  before do
7
- @stl = RADMesh::STL.new 'block.stl'
9
+ @stl = RADMesh::STL.new STL_FILE
8
10
  @axes = [:x, :y, :z]
9
11
  end
10
12
 
@@ -189,7 +191,7 @@ describe RADMesh::STL do
189
191
  end
190
192
  it 'must open merge other STLs' do
191
193
  @stl.translate! 10, 10, 10
192
- @stl.open_merge! 'block.stl'
194
+ @stl.open_merge! STL_FILE
193
195
  @stl.calculate_volume!.stats[:volume].must_equal 2
194
196
  end
195
197
  it 'must repair without blowing up' do
@@ -262,7 +264,7 @@ describe RADMesh::STL do
262
264
  end
263
265
  it 'must open merge fine' do
264
266
  stl = RADMesh::STL.new
265
- stl.open_merge! 'block.stl'
267
+ stl.open_merge! STL_FILE
266
268
  stl.stats[:size][:x].must_equal 1
267
269
  end
268
270
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radmesh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.98.1
4
+ version: 0.98.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miro Hrončok
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-01-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ! " ADMesh is a library for processing triangulated solid meshes.\n
14
14
  \ Currently, ADMesh only reads the STL file format that is used\n for rapid
@@ -23,10 +23,14 @@ files:
23
23
  - LICENSE
24
24
  - README.md
25
25
  - Rakefile
26
- - block.stl
27
- - lib/cadmesh.rb
28
26
  - lib/radmesh.rb
27
+ - lib/radmesh/cadmesh.rb
28
+ - lib/radmesh/libc.rb
29
+ - lib/radmesh/os.rb
30
+ - lib/radmesh/stl.rb
31
+ - lib/radmesh/version.rb
29
32
  - radmesh.gemspec
33
+ - spec/fixtures/block.stl
30
34
  - spec/radmesh_spec.rb
31
35
  homepage: https://github.com/admesh/rubygem-admesh
32
36
  licenses:
@@ -53,3 +57,4 @@ signing_key:
53
57
  specification_version: 4
54
58
  summary: Ruby wrapper around ADMesh
55
59
  test_files: []
60
+ has_rdoc:
data/lib/cadmesh.rb DELETED
@@ -1,192 +0,0 @@
1
- require 'ffi'
2
-
3
- # Low level wrapper around C admesh library
4
- # @!visibility private
5
- module CADMesh
6
- extend FFI::Library
7
- ffi_lib 'admesh.so.1.0.0'
8
-
9
- # for JRuby
10
- begin
11
- CharArray = FFI::StructLayout::CharArray
12
- InlineArray = FFI::Struct::InlineArray
13
- rescue NameError
14
- CharArray = FFI::StructLayout::CharArrayProxy
15
- InlineArray = FFI::StructLayout::ArrayProxy
16
- end
17
-
18
- enum :STLType, [:binary, :ascii, :inmemory]
19
-
20
- # FFI::Struct that has to_hash
21
- # @!visibility private
22
- class HashableStruct < FFI::Struct
23
- # @!visibility private
24
- def to_hash
25
- hash = {}
26
- members.each do |key|
27
- hash[key] = self.class.value_to_value(self[key])
28
- end
29
- hash
30
- end
31
-
32
- # @!visibility private
33
- def self.value_to_value(value)
34
- return value.to_s if value.class == CharArray
35
- return value.to_a.map(&:to_hash) if value.class == InlineArray
36
- return value.to_hash if value.class <= HashableStruct
37
- value
38
- end
39
- end
40
-
41
- # stl_vertex struct
42
- # @!visibility private
43
- class STLVertex < HashableStruct
44
- layout :x, :float,
45
- :y, :float,
46
- :z, :float
47
- end
48
-
49
- # stl_normal struct
50
- # @!visibility private
51
- class STLNormal < HashableStruct
52
- layout :x, :float,
53
- :y, :float,
54
- :z, :float
55
- end
56
-
57
- # stl_facet struct
58
- # @!visibility private
59
- class STLFacet < HashableStruct
60
- layout :normal, STLNormal,
61
- :vertex, [STLVertex, 3],
62
- :extra, [:char, 2]
63
- end
64
-
65
- # stl_neighbors struct
66
- # @!visibility private
67
- class STLNeighbors < HashableStruct
68
- layout :neighbor, [:int, 3],
69
- :which_vertex_not, [:char, 3]
70
- end
71
-
72
- # stl_stats struct
73
- # @!visibility private
74
- class STLStats < HashableStruct
75
- layout :header, [:char, 81],
76
- :type, :STLType,
77
- :number_of_facets, :int,
78
- :max, STLVertex,
79
- :min, STLVertex,
80
- :size, STLVertex,
81
- :bounding_diameter, :float,
82
- :shortest_edge, :float,
83
- :volume, :float,
84
- :number_of_blocks, :uint,
85
- :connected_edges, :int,
86
- :connected_facets_1_edge, :int,
87
- :connected_facets_2_edge, :int,
88
- :connected_facets_3_edge, :int,
89
- :facets_w_1_bad_edge, :int,
90
- :facets_w_2_bad_edge, :int,
91
- :facets_w_3_bad_edge, :int,
92
- :original_num_facets, :int,
93
- :edges_fixed, :int,
94
- :degenerate_facets, :int,
95
- :facets_removed, :int,
96
- :facets_added, :int,
97
- :facets_reversed, :int,
98
- :backwards_edges, :int,
99
- :normals_fixed, :int,
100
- :number_of_parts, :int,
101
- :malloced, :int,
102
- :freed, :int,
103
- :facets_malloced, :int,
104
- :collisions, :int,
105
- :shared_vertices, :int,
106
- :shared_malloced, :int
107
- end
108
-
109
- # stl_file struct
110
- # @!visibility private
111
- class STLFile < HashableStruct
112
- layout :fp, :pointer,
113
- :facet_start, STLFacet.ptr,
114
- :edge_start, :pointer,
115
- :heads, :pointer,
116
- :tail, :pointer,
117
- :M, :int,
118
- :neighbors_start, :pointer,
119
- :v_indices, :pointer,
120
- :v_shared, :pointer,
121
- :stats, STLStats,
122
- :error, :char
123
- end
124
-
125
- attach_function :stl_open, [:pointer, :string], :void
126
- attach_function :stl_close, [:pointer], :void
127
- attach_function :stl_stats_out, [:pointer, :pointer, :string], :void
128
- attach_function :stl_print_edges, [:pointer, :pointer], :void
129
- attach_function :stl_print_neighbors, [:pointer, :string], :void
130
- attach_function :stl_put_little_int, [:pointer, :int], :void
131
- attach_function :stl_put_little_float, [:pointer, :float], :void
132
- attach_function :stl_write_ascii, [:pointer, :string, :string], :void
133
- attach_function :stl_write_binary, [:pointer, :string, :string], :void
134
- attach_function :stl_write_binary_block, [:pointer, :pointer], :void
135
- attach_function :stl_check_facets_exact, [:pointer], :void
136
- attach_function :stl_check_facets_nearby, [:pointer, :float], :void
137
- attach_function :stl_remove_unconnected_facets, [:pointer], :void
138
- attach_function :stl_write_vertex, [:pointer, :int, :int], :void
139
- attach_function :stl_write_facet, [:pointer, :string, :int], :void
140
- attach_function :stl_write_neighbor, [:pointer, :int], :void
141
- attach_function :stl_write_quad_object, [:pointer, :string], :void
142
- attach_function :stl_verify_neighbors, [:pointer], :void
143
- attach_function :stl_fill_holes, [:pointer], :void
144
- attach_function :stl_fix_normal_directions, [:pointer], :void
145
- attach_function :stl_fix_normal_values, [:pointer], :void
146
- attach_function :stl_reverse_all_facets, [:pointer], :void
147
- attach_function :stl_translate, [:pointer, :float, :float, :float], :void
148
- attach_function :stl_translate_relative, [:pointer, :float,
149
- :float, :float], :void
150
- attach_function :stl_scale_versor, [:pointer, :pointer], :void
151
- attach_function :stl_scale, [:pointer, :float], :void
152
- attach_function :stl_rotate_x, [:pointer, :float], :void
153
- attach_function :stl_rotate_y, [:pointer, :float], :void
154
- attach_function :stl_rotate_z, [:pointer, :float], :void
155
- attach_function :stl_mirror_xy, [:pointer], :void
156
- attach_function :stl_mirror_yz, [:pointer], :void
157
- attach_function :stl_mirror_xz, [:pointer], :void
158
- attach_function :stl_open_merge, [:pointer, :string], :void
159
- attach_function :stl_invalidate_shared_vertices, [:pointer], :void
160
- attach_function :stl_generate_shared_vertices, [:pointer], :void
161
- attach_function :stl_write_obj, [:pointer, :string], :void
162
- attach_function :stl_write_off, [:pointer, :string], :void
163
- attach_function :stl_write_dxf, [:pointer, :string, :string], :void
164
- attach_function :stl_write_vrml, [:pointer, :string], :void
165
- attach_function :stl_calculate_normal, [:pointer, :pointer], :void
166
- attach_function :stl_normalize_vector, [:pointer], :void
167
- attach_function :stl_calculate_volume, [:pointer], :void
168
-
169
- attach_function :stl_repair, [:pointer, :int, :int, :int,
170
- :float, :int, :float, :int,
171
- :int, :int, :int, :int, :int,
172
- :int, :int], :void
173
-
174
- attach_function :stl_initialize, [:pointer], :void
175
- attach_function :stl_count_facets, [:pointer, :string], :void
176
- attach_function :stl_allocate, [:pointer], :void
177
- attach_function :stl_read, [:pointer, :int, :int], :void
178
- attach_function :stl_reallocate, [:pointer], :void
179
- attach_function :stl_add_facet, [:pointer, :pointer], :void
180
- attach_function :stl_get_size, [:pointer], :void
181
-
182
- attach_function :stl_clear_error, [:pointer], :void
183
- attach_function :stl_get_error, [:pointer], :int
184
- end
185
-
186
- # helper module for memcpy
187
- # @!visibility private
188
- module LibC
189
- extend FFI::Library
190
- ffi_lib FFI::Library::LIBC
191
- attach_function :memcpy, [:pointer, :pointer, :size_t], :pointer
192
- end