Module: GreinerHormann

Defined in:
lib/greiner_hormann.rb,
lib/greiner_hormann/vertex.rb,
lib/greiner_hormann/polygon.rb,
lib/greiner_hormann/version.rb,
lib/greiner_hormann/intersection.rb

Defined Under Namespace

Classes: Intersection, Polygon, Vertex

Constant Summary collapse

VERSION =
'0.1.1'

Class Method Summary collapse

Class Method Details

.clip(poly_a, poly_b, source_forwards, clip_forwards) ⇒ Object



6
7
8
9
10
# File 'lib/greiner_hormann.rb', line 6

def self.clip(poly_a, poly_b, source_forwards, clip_forwards)
  source = Polygon.new(poly_a)
  clip = Polygon.new(poly_b)
  source.clip(clip, source_forwards, clip_forwards)
end

.difference(poly_a, poly_b) ⇒ Object



20
21
22
# File 'lib/greiner_hormann.rb', line 20

def self.difference(poly_a, poly_b)
  clip(poly_a, poly_b, false, true)
end

.intersection(poly_a, poly_b) ⇒ Object



16
17
18
# File 'lib/greiner_hormann.rb', line 16

def self.intersection(poly_a, poly_b)
  clip(poly_a, poly_b, true, true)
end

.union(poly_a, poly_b) ⇒ Object



12
13
14
# File 'lib/greiner_hormann.rb', line 12

def self.union(poly_a, poly_b)
  clip(poly_a, poly_b, false, false)
end