Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/prawn_shapes/arc.rb
Instance Method Summary collapse
-
#unit_perpendicular_vector(options = {}) ⇒ Object
if :counter_clockwise => true option, then return a new vector that points 90 degrees counterlockwise of aVector with a magnitude of 1.0, otherwise return a new vector that points 90 degrees clockwise of aVector with a magnitude of 1.0.
- #unit_vector ⇒ Object
Instance Method Details
#unit_perpendicular_vector(options = {}) ⇒ Object
if :counter_clockwise => true option, then return a new vector that points 90 degrees counterlockwise of aVector with a magnitude of 1.0, otherwise return a new vector that points 90 degrees clockwise of aVector with a magnitude of 1.0
208 209 210 211 |
# File 'lib/prawn_shapes/arc.rb', line 208 def unit_perpendicular_vector(={}) return [self[1], -self[0]].unit_vector if [:counter_clockwise] [-self[1], self[0]].unit_vector end |
#unit_vector ⇒ Object
198 199 200 201 202 |
# File 'lib/prawn_shapes/arc.rb', line 198 def unit_vector denominator = Math.sqrt(self[0] * self[0] + self[1] * self[1]) return self if denominator == 0.0 [self[0] / denominator, self[1] / denominator] end |