Module: Wicket::Commands::BezierCurve

Included in:
CubicBezier, QuadraticBezier
Defined in:
lib/wicket/commands/bezier_curve.rb

Instance Method Summary collapse

Instance Method Details

#evaluate_curve(t) ⇒ Object



5
6
7
8
9
# File 'lib/wicket/commands/bezier_curve.rb', line 5

def evaluate_curve(t)
  x = de_casteljau(:x,t,*control_points)
  y = de_casteljau(:y,t,*control_points)
  [x,y,t]
end

#to_svg(opts = {}) ⇒ Object



16
17
18
19
# File 'lib/wicket/commands/bezier_curve.rb', line 16

def to_svg(opts={})
  o = @opts.merge(opts)
  "L #{subpoints(o).reject{|s| s.t == 0}.map{|s| s.to_svg(o) }.join(" ")}"
end

#to_wkt(opts = {}) ⇒ Object



11
12
13
14
# File 'lib/wicket/commands/bezier_curve.rb', line 11

def to_wkt(opts={})
  o = @opts.merge(opts)
  subpoints(o).reject{|s| s.t == 0 }.map{|s| s.to_wkt(o) }.join(",")
end