Module: SolidRuby::CSGModelling
- Included in:
- SolidRuby
- Defined in:
- lib/solidruby/csg_modelling/hull.rb,
lib/solidruby/csg_modelling/union.rb,
lib/solidruby/csg_modelling/minkowski.rb,
lib/solidruby/csg_modelling/difference.rb,
lib/solidruby/csg_modelling/intersection.rb,
lib/solidruby/csg_modelling/csg_modelling.rb
Overview
This file is part of SolidRuby.
SolidRuby is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SolidRuby is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SolidRuby. If not, see <http://www.gnu.org/licenses/>.
Defined Under Namespace
Classes: CSGModelling, Difference, Hull, Intersection, Minkowski, Union
Instance Method Summary
collapse
Instance Method Details
#*(args) ⇒ Object
20
21
22
23
|
# File 'lib/solidruby/csg_modelling/intersection.rb', line 20
def *(args)
return args if nil?
Intersection.new(self, args)
end
|
#+(args) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/solidruby/csg_modelling/union.rb', line 20
def +(args)
return args if nil?
if args.is_a? Array
r = self
args.each do |a|
r = Union.new(r, a)
end
r
else
optimize_union(self, args)
end
end
|
#-(args) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/solidruby/csg_modelling/difference.rb', line 20
def -(args)
return args if nil?
if args.is_a? Array
r = self
args.each do |a|
r = Difference.new(r, a)
end
r
else
optimize_difference(self, args)
end
end
|
#hull(*parts) ⇒ Object
20
21
22
|
# File 'lib/solidruby/csg_modelling/hull.rb', line 20
def hull(*parts)
Hull.new(*parts)
end
|
#minkowski(*parts) ⇒ Object
20
21
22
|
# File 'lib/solidruby/csg_modelling/minkowski.rb', line 20
def minkowski(*parts)
Minkowski.new(*parts)
end
|
#optimize_difference(top, child) ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/solidruby/csg_modelling/difference.rb', line 33
def optimize_difference(top, child)
if top.is_a?(Difference) && (!child.is_a? Difference) && top.transformations.empty?
top.children << child
top
else
Difference.new(top, child)
end
end
|
#optimize_union(top, child) ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/solidruby/csg_modelling/union.rb', line 33
def optimize_union(top, child)
if top.is_a?(Union) && (!child.is_a? Union) && top.transformations.empty?
top.children << child
top
else
Union.new(top, child)
end
end
|