Class: CGPoint
- Inherits:
-
Object
- Object
- CGPoint
- Defined in:
- lib/project/cg_point.rb
Class Method Summary collapse
-
.golden_section(options) ⇒ CGPoint
Given an x or y coordinate, returns a point with the other coordinate set to the golden section.
Instance Method Summary collapse
-
#golden_section(direction = :both, exp = 1) ⇒ CGPoint
Returns a CGPoint with one or both coordinates as a golden section.
Class Method Details
.golden_section(options) ⇒ CGPoint
Given an x or y coordinate, returns a point with the other coordinate set to the golden section
7 8 9 |
# File 'lib/project/cg_point.rb', line 7 def self.golden_section() Golden_Sections.handler(Golden_Sections::CGPoint_relations, , &Golden_Sections::CGPoint_proc) end |
Instance Method Details
#golden_section(direction = :both, exp = 1) ⇒ CGPoint
Returns a CGPoint with one or both coordinates as a golden section
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/project/cg_point.rb', line 15 def golden_section(direction=:both, exp=1) if direction==:both CGPoint.new(self.x.golden_section(exp), self.y.golden_section(exp)) elsif direction==:x CGPoint.new(self.x.golden_section(exp), self.y) elsif direction==:y CGPoint.new(self.x, self.y.golden_section(exp)) else raise "CGPoint: unknown direction #{direction}" end end |