Class: Geom::Vector2d
- Inherits:
-
Object
- Object
- Geom::Vector2d
- Defined in:
- lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb
Overview
The Vector2d class represents vectors in a 2 dimensional space.
There are numerous tutorials on 2D vectors available on the internet.
Instance Method Summary collapse
- #%(vector) ⇒ Object
- #*(vector) ⇒ Geom::Vector2d
- #+(vector) ⇒ Geom::Vector2d
- #-(vector) ⇒ Geom::Vector2d
- #==(vector) ⇒ Boolean
- #[](index) ⇒ Numeric
- #[]=(index, value) ⇒ Numeric
-
#angle_between(vector) ⇒ Numeric
The #angle_between method computes the angle in radians between the Vector2d and another Vector2d.
- #clone ⇒ Geom::Vector2d
- #cross(vector) ⇒ Geom::Vector2d
- #dot(vector) ⇒ Object
-
#initialize(*args) ⇒ Vector2d
constructor
The new method creates a new Vector2d.
- #inspect ⇒ String
- #length ⇒ Length
- #length=(length) ⇒ Numeric
-
#normalize ⇒ Geom::Vector2d
The #normalize method returns a Vector2d that is a unit vector of the Vector2d.
-
#normalize! ⇒ Object
The #normalize! method converts a Vector2d vector into a unit vector.
-
#parallel?(vector) ⇒ Boolean
The #parallel? method determines if the Vector2d is parallel to another Vector2d to within tolerance.
-
#perpendicular?(vector) ⇒ Boolean
The #perpendicular? method determines if the Vector2d is perpendicular to another Vector2d to within tolerance.
- #reverse ⇒ Geom::Vector2d
- #reverse! ⇒ Object
-
#same_direction?(vector) ⇒ Boolean
The #same_direction? method determines if the Vector2d is parallel to and in the same direction as another Vector2d within tolerance.
- #set!(*args) ⇒ Object
- #to_a ⇒ Array(Numeric, Numeric)
- #to_s ⇒ String
-
#transform(transform) ⇒ Geom::Vector2d
The #transform method applies a transformation to a vector, returning a new vector.
-
#transform!(transform) ⇒ Geom::Vector2d
The #transform! method applies a transformation to a vector.
-
#unit_vector? ⇒ Boolean
The #unit_vector? method returns whether the Vector2d is a unit vector.
- #valid? ⇒ Boolean
- #x ⇒ Numeric
- #x=(x) ⇒ Numeric
- #y ⇒ Numeric
- #y=(y) ⇒ Numeric
Constructor Details
#initialize ⇒ Geom::Vector2d #initialize(x, y) ⇒ Geom::Vector2d #initialize(vector) ⇒ Geom::Vector2d
The new method creates a new Geom::Vector2d.
213 214 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 213 def initialize(*args) end |
Instance Method Details
#%(vector) ⇒ Object
The #% method returns the dot product between two Geom::Vector2d. This is an alias of the dot method.
26 27 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 26 def %(vector) end |
#*(vector) ⇒ Geom::Vector2d
The #* method returns the cross product between two Geom::Vector2d. This is an alias of the cross method.
42 43 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 42 def *(vector) end |
#+(vector) ⇒ Geom::Vector2d
The #+ method adds a Geom::Vector2d to this one.
57 58 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 57 def +(vector) end |
#-(vector) ⇒ Geom::Vector2d
The #- method subtracts a Geom::Vector2d from this one.
72 73 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 72 def -(vector) end |
#==(vector) ⇒ Boolean
The #== method returns whether two Geom::Vector2d are equal within tolerance.
89 90 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 89 def ==(vector) end |
#[](index) ⇒ Numeric
The #[] method returns the value of the Geom::Vector2d at the specified index.
106 107 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 106 def [](index) end |
#[]=(index, value) ⇒ Numeric
The #[]= method sets the x or y value of the Geom::Vector2d based on the specific index of the value.
126 127 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 126 def []=(index, value) end |
#angle_between(vector) ⇒ Numeric
The #angle_between method computes the angle in radians between the Geom::Vector2d and another Geom::Vector2d.
143 144 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 143 def angle_between(vector) end |
#clone ⇒ Geom::Vector2d
The #clone method makes a copy of the Geom::Vector2d. This method is equivalent to vec2 = Geom::Vector2d.new(vec).
156 157 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 156 def clone end |
#cross(vector) ⇒ Geom::Vector2d
The #* method returns the cross product between two Geom::Vector2d. This is an alias of the cross method.
172 173 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 172 def cross(vector) end |
#dot(vector) ⇒ Object
The #% method returns the dot product between two Geom::Vector2d. This is an alias of the dot method.
188 189 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 188 def dot(vector) end |
#inspect ⇒ String
The #inspect method formats the Geom::Vector2d as a string.
225 226 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 225 def inspect end |
#length ⇒ Length
The #length method returns the length of the Geom::Vector2d.
238 239 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 238 def length end |
#length=(length) ⇒ Numeric
The #length= method sets the length of the Geom::Vector2d. The new length must not be 0.
255 256 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 255 def length=(length) end |
#normalize ⇒ Geom::Vector2d
The #normalize method returns a Geom::Vector2d that is a unit vector of the Geom::Vector2d.
269 270 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 269 def normalize end |
#normalize! ⇒ Object
The #normalize! method converts a Geom::Vector2d vector into a unit vector. Another way to do this is vector.length = 1
281 282 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 281 def normalize! end |
#parallel?(vector) ⇒ Boolean
The #parallel? method determines if the Geom::Vector2d is parallel to another Geom::Vector2d to within tolerance.
298 299 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 298 def parallel?(vector) end |
#perpendicular?(vector) ⇒ Boolean
The #perpendicular? method determines if the Geom::Vector2d is perpendicular to another Geom::Vector2d to within tolerance.
315 316 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 315 def perpendicular?(vector) end |
#reverse ⇒ Geom::Vector2d
The #reverse method returns a new Geom::Vector2d that is the reverse of the Geom::Vector2d, leaving the original unchanged.
329 330 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 329 def reverse end |
#reverse! ⇒ Object
The #reverse! method reverses the Geom::Vector2d in place.
340 341 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 340 def reverse! end |
#same_direction?(vector) ⇒ Boolean
The #same_direction? method determines if the Geom::Vector2d is parallel to and in the same direction as another Geom::Vector2d within tolerance.
357 358 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 357 def same_direction?(vector) end |
#set!(vector) ⇒ Geom::Vector2d #set!(x, y) ⇒ Geom::Vector2d
The #set! method sets the values of the Geom::Vector2d.
378 379 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 378 def set!(*args) end |
#to_a ⇒ Array(Numeric, Numeric)
The #to_a method retrieves the coordinates of the Geom::Vector2d in an Array.
390 391 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 390 def to_a end |
#to_s ⇒ String
The #to_s method returns a string representation of the Geom::Vector2d.
402 403 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 402 def to_s end |
#transform(transform) ⇒ Geom::Vector2d
The #transform method applies a transformation to a vector, returning a new vector. The original vector is unchanged by this method.
420 421 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 420 def transform(transform) end |
#transform!(transform) ⇒ Geom::Vector2d
The #transform! method applies a transformation to a vector. The vector itself is modified.
438 439 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 438 def transform!(transform) end |
#unit_vector? ⇒ Boolean
The #unit_vector? method returns whether the Geom::Vector2d is a unit vector. This is equivalent to vector.length == 1.0
452 453 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 452 def unit_vector? end |
#valid? ⇒ Boolean
The #valid? method verifies if a Geom::Vector2d is valid. A Geom::Vector2d is valid if its length is not zero.
465 466 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 465 def valid? end |
#x ⇒ Numeric
The #x method retrieves the x value of the Geom::Vector2d.
477 478 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 477 def x end |
#x=(x) ⇒ Numeric
The #x= method sets the x coordinate of the Geom::Vector2d.
492 493 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 492 def x=(x) end |
#y ⇒ Numeric
The #y method retrieves the y value of the Geom::Vector2d.
504 505 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 504 def y end |
#y=(y) ⇒ Numeric
The #y= method sets the y coordinate of the Geom::Vector2d.
519 520 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb', line 519 def y=(y) end |