Class: Sunniesnow::Tools::SvgPath::QuadraticBezier

Inherits:
PathSegment
  • Object
show all
Includes:
Curve
Defined in:
lib/sscharter/tools/svg_path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Curve

#at_length, #length

Methods inherited from PathSegment

#at_length, #length

Constructor Details

#initialize(begin_point, control_point, end_point, segments: 8) ⇒ QuadraticBezier

Returns a new instance of QuadraticBezier.

Parameters:



191
192
193
194
195
196
# File 'lib/sscharter/tools/svg_path.rb', line 191

def initialize begin_point, control_point, end_point, segments: 8
	@begin = begin_point
	@control = control_point
	@end = end_point
	make_segments segments
end

Instance Attribute Details

#beginVector2D (readonly)

Returns:



179
180
181
# File 'lib/sscharter/tools/svg_path.rb', line 179

def begin
  @begin
end

#controlVector2D (readonly)

Returns:



182
183
184
# File 'lib/sscharter/tools/svg_path.rb', line 182

def control
  @control
end

#endVector2D (readonly)

Returns:



185
186
187
# File 'lib/sscharter/tools/svg_path.rb', line 185

def end
  @end
end

Instance Method Details

#at(t) ⇒ Vector2D

Parameters:

  • t (Float)

Returns:



200
201
202
# File 'lib/sscharter/tools/svg_path.rb', line 200

def at t
	@begin*(1-t)**2 + @control*(2*(1-t)*t) + @end*t**2
end