Class: Sunniesnow::Tools::SvgPath::QuadraticBezier
- Inherits:
-
PathSegment
- Object
- PathSegment
- Sunniesnow::Tools::SvgPath::QuadraticBezier
- Includes:
- Curve
- Defined in:
- lib/sscharter/tools/svg_path.rb
Instance Attribute Summary collapse
- #begin ⇒ Vector2D readonly
- #control ⇒ Vector2D readonly
- #end ⇒ Vector2D readonly
Instance Method Summary collapse
- #at(t) ⇒ Vector2D
-
#initialize(begin_point, control_point, end_point, segments: 8) ⇒ QuadraticBezier
constructor
A new instance of QuadraticBezier.
Methods included from Curve
Methods inherited from PathSegment
Constructor Details
#initialize(begin_point, control_point, end_point, segments: 8) ⇒ QuadraticBezier
Returns a new instance of QuadraticBezier.
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
#begin ⇒ Vector2D (readonly)
179 180 181 |
# File 'lib/sscharter/tools/svg_path.rb', line 179 def begin @begin end |
#control ⇒ Vector2D (readonly)
182 183 184 |
# File 'lib/sscharter/tools/svg_path.rb', line 182 def control @control end |
#end ⇒ Vector2D (readonly)
185 186 187 |
# File 'lib/sscharter/tools/svg_path.rb', line 185 def end @end end |
Instance Method Details
#at(t) ⇒ Vector2D
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 |