Class: XRVG::OffsetVariety

Inherits:
Object
  • Object
show all
Includes:
Attributable, GeoVariety
Defined in:
lib/geovariety.rb

Overview

OffsetVariety implementation

Principle

Geovariety is defined by the set of offset curves from -ampl to +ampl

Extension

Parameter could be a :samplable parameter : in that case, ampl will vary

Another extension would be to parametrize range straightforwardly

Finally, the two previous remarks must be synthetized :-)

Instance Method Summary collapse

Methods included from GeoVariety

#bezier

Constructor Details

#initialize(*args) ⇒ OffsetVariety

builder: init static offset range with (-self.ampl..self.ampl)



81
82
83
84
# File 'lib/geovariety.rb', line 81

def initialize( *args )
  super( *args )
  @range = (-self.ampl..self.ampl)
end

Instance Method Details

#line(x1, x2, y) ⇒ Object

subgeodesic computed by computing offset curve with ampl y coord



93
94
95
96
# File 'lib/geovariety.rb', line 93

def line( x1, x2, y )
  curve = Offset[ :support, @support, :ampl, @range.sample( y ) ]
  return curve.apply_split( x1, x2 )
end

#point(point) ⇒ Object

point computed by computing offset curve with ampl y coord mapped onto offset range, and then sampling the curve with x coord



87
88
89
90
# File 'lib/geovariety.rb', line 87

def point( point )
  curve = Offset[ :support, @support, :ampl, @range.sample( point.y ) ]
  return curve.point( point.x )
end