This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Slicer takes a polyhedron and slices it accross the xy plane | |
#at a given interval. It uses a technique called vertex shifting | |
#to avoid planes intercepting vertices and edges. | |
#It has only been tested on triangulated manifold volumes. | |
class Slicer | |
#Specify the starting and finishing values for the z axis | |
#Optionally specify how often to perform the slice | |
def initialize(z_from, z_to, z_step = 0.5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Nester | |
def initialize | |
@checklist = [] | |
end | |
def nest(source, target, source_sym = nil) | |
if source.is_a?(Module) | |
source_sym = source.name.split("::").last.to_sym if source_sym.nil? | |
if source.is_a?(Class) | |
kls = source.clone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynameshTool | |
def initialize | |
end | |
def sort_vertices(v1,v2,orientation,direction,view) | |
coords = [v1,v2].collect{|v| | |
pos = view.screen_coords(v.position) | |
case orientation | |
when :horizontal then pos[0] | |
when :vertical then pos[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use needle by telling it how many cpus you want to use | |
# and what you want it to do. | |
# Then just feed it data and watch all your cores go crazy. | |
# You can feed it standard ruby objects and it will return all | |
# results in the same order you gave them to it. | |
# n = Needle.new(cpus) {|input| input.do_something } | |
# result_of_all = n.sew[a,b,c,d,e,f,g,h,i...] | |
# uncomment the lines at the bottom to run the test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//hello_world.cpp | |
//The following DOESN'T compile | |
#include <ruby.h> | |
#include <boost/shared_ptr.hpp> | |
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> | |
#include <CGAL/Polygon_2.h> | |
#include <CGAL/create_straight_skeleton_2.h> //ADDING THIS CAUSES COMPILATION TO FAIL | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
def self.method_added(m) | |
super(m) | |
if @wrap_method | |
@wrap_method = nil | |
a = "__#{m}__".to_sym | |
alias_method a, m | |
define_method(m){ | |
begin |