Class: SDC::Coordinates
- Inherits:
-
Object
- Object
- SDC::Coordinates
- Defined in:
- engine_docs/automatic_doc_Coordinates.rb,
engine_docs/automatic_doc_Coordinates.rb
Overview
2D coordinate vector class for positions
Instance Attribute Summary collapse
-
#x ⇒ Float
Horizontal component of the vector.
-
#y ⇒ Float
Vertical component of the vector.
Instance Method Summary collapse
-
#*(scalar) ⇒ Coordinates
Returns the vector multiplied by the scalar value.
-
#+(other) ⇒ Coordinates
Adds the two vectors to a new vector.
-
#-(other) ⇒ Coordinates
Subtracts the two vectors to a new vector.
-
#dot(other) ⇒ Float
Returns the scalar product of the two vectors.
-
#initialize(x = 0.0, y = 0.0) ⇒ Coordinates
constructor
Creates a coordinate object with the given coordinates.
-
#inspect ⇒ String
Returns the vector in a easily readable string format.
-
#squared_norm ⇒ Float
Returns the squared norm of the vector.
-
#to_s ⇒ String
Puts the coordinates in a string.
Constructor Details
#initialize(x = 0.0, y = 0.0) ⇒ Coordinates
Creates a coordinate object with the given coordinates
|
# File 'engine_docs/automatic_doc_Coordinates.rb', line 9
|
Instance Attribute Details
#x ⇒ Float
Horizontal component of the vector
|
# File 'engine_docs/automatic_doc_Coordinates.rb', line 16
|
#y ⇒ Float
Vertical component of the vector
|
# File 'engine_docs/automatic_doc_Coordinates.rb', line 20
|
Instance Method Details
#*(scalar) ⇒ Coordinates
Returns the vector multiplied by the scalar value
|
# File 'engine_docs/automatic_doc_Coordinates.rb', line 36
|
#+(other) ⇒ Coordinates
Adds the two vectors to a new vector
|
# File 'engine_docs/automatic_doc_Coordinates.rb', line 24
|
#-(other) ⇒ Coordinates
Subtracts the two vectors to a new vector
|
# File 'engine_docs/automatic_doc_Coordinates.rb', line 30
|
#dot(other) ⇒ Float
Returns the scalar product of the two vectors
|
# File 'engine_docs/automatic_doc_Coordinates.rb', line 42
|
#inspect ⇒ String
Returns the vector in a easily readable string format
|
# File 'engine_docs/automatic_doc_Coordinates.rb', line 58
|
#squared_norm ⇒ Float
Returns the squared norm of the vector
|
# File 'engine_docs/automatic_doc_Coordinates.rb', line 48
|
#to_s ⇒ String
Puts the coordinates in a string
|
# File 'engine_docs/automatic_doc_Coordinates.rb', line 53
|