module SolidRuby::CSGModelling
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 <www.gnu.org/licenses/>.
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 <www.gnu.org/licenses/>.
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 <www.gnu.org/licenses/>.
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 <www.gnu.org/licenses/>.
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 <www.gnu.org/licenses/>.
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 <www.gnu.org/licenses/>.
Public Instance Methods
# File lib/solidruby/csg_modelling/intersection.rb, line 20 def *(args) return args if nil? Intersection.new(self, args) end
# 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
# 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
# File lib/solidruby/csg_modelling/hull.rb, line 20 def hull(*parts) Hull.new(*parts) end
# File lib/solidruby/csg_modelling/minkowski.rb, line 20 def minkowski(*parts) Minkowski.new(*parts) end
# 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
# 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