Class: Sunniesnow::Tools::SvgPath::Arc
- Inherits:
-
PathSegment
- Object
- PathSegment
- Sunniesnow::Tools::SvgPath::Arc
- Includes:
- Curve
- Defined in:
- lib/sscharter/tools/svg_path.rb
Instance Attribute Summary collapse
- #begin ⇒ Vector2D readonly
- #end ⇒ Vector2D readonly
- #large_arc ⇒ Boolean readonly
- #radius ⇒ Numeric readonly
- #rotation ⇒ Numeric readonly
- #sweep_positive ⇒ Boolean readonly
Instance Method Summary collapse
- #at(t) ⇒ Vector2D
-
#initialize(begin_point, radius, rotation, large_arc, sweep_positive, end_point, segments: 8) ⇒ Arc
constructor
A new instance of Arc.
Methods included from Curve
Methods inherited from PathSegment
Constructor Details
#initialize(begin_point, radius, rotation, large_arc, sweep_positive, end_point, segments: 8) ⇒ Arc
Returns a new instance of Arc.
268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/sscharter/tools/svg_path.rb', line 268 def initialize begin_point, radius, rotation, large_arc, sweep_positive, end_point, segments: 8 @begin = begin_point @radius = radius @rotation = rotation @large_arc = large_arc @sweep_positive = sweep_positive @end = end_point raise GeometryError.new 'Radius must be positive' if @radius.x <= 0 || @radius.y <= 0 raise GeometryError.new 'Cannot draw arc with same begin and end point' if @begin == @end solve_center make_segments segments end |
Instance Attribute Details
#begin ⇒ Vector2D (readonly)
244 245 246 |
# File 'lib/sscharter/tools/svg_path.rb', line 244 def begin @begin end |
#end ⇒ Vector2D (readonly)
259 260 261 |
# File 'lib/sscharter/tools/svg_path.rb', line 259 def end @end end |
#large_arc ⇒ Boolean (readonly)
253 254 255 |
# File 'lib/sscharter/tools/svg_path.rb', line 253 def large_arc @large_arc end |
#radius ⇒ Numeric (readonly)
247 248 249 |
# File 'lib/sscharter/tools/svg_path.rb', line 247 def radius @radius end |
#rotation ⇒ Numeric (readonly)
250 251 252 |
# File 'lib/sscharter/tools/svg_path.rb', line 250 def rotation @rotation end |
#sweep_positive ⇒ Boolean (readonly)
256 257 258 |
# File 'lib/sscharter/tools/svg_path.rb', line 256 def sweep_positive @sweep_positive end |