Class: Sevgi::Geometry::Circle
- Inherits:
-
Ellipse
- Object
- Element
- Element::Arced
- Ellipse
- Sevgi::Geometry::Circle
- Defined in:
- lib/sevgi/geometry/elements/circle.rb
Overview
Complete circular boundary with a positive radius and a center. Uniform scaling preserves Circle. General affine transforms can return Ellipse.
Instance Attribute Summary
Attributes inherited from Ellipse
#position, #rotation, #rx, #ry
Class Method Summary collapse
-
.[](radius, position: Origin) ⇒ Sevgi::Geometry::Circle
Builds a circle from its radius and center.
Instance Method Summary collapse
-
#draw(node, **attributes) ⇒ Object
Draws a native SVG circle without rounding the geometry.
-
#radius ⇒ Float
Returns the circle radius.
Methods inherited from Ellipse
#approx, #arc, #box, #circular?, #empty?, #equation, #equations, #initialize, #inside?, #length, #on?, #perimeter, #point, #reflect, #rotate, #scale, #skew, #skew_x, #skew_y, #translate
Methods inherited from Element::Arced
Methods inherited from Element
#at, #box, #closed?, #equations, #ignorable?, #intersection, lined, #position, #translate
Constructor Details
This class inherits a constructor from Sevgi::Geometry::Ellipse
Class Method Details
.[](radius, position: Origin) ⇒ Sevgi::Geometry::Circle
Builds a circle from its radius and center.
15 |
# File 'lib/sevgi/geometry/elements/circle.rb', line 15 def self.[](radius, position: Origin) = new(radius, radius, position:, rotation: 0) |
Instance Method Details
#draw(node, **attributes) ⇒ Object
Draws a native SVG circle without rounding the geometry.
21 |
# File 'lib/sevgi/geometry/elements/circle.rb', line 21 def draw(node, **attributes) = node.circle(cx: position.x, cy: position.y, r: radius, **attributes) |
#radius ⇒ Float
Returns the circle radius.
25 |
# File 'lib/sevgi/geometry/elements/circle.rb', line 25 def radius = rx |