Class: SDC::Coordinates

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(x = 0.0, y = 0.0) ⇒ Coordinates

Creates a coordinate object with the given coordinates

Parameters:

  • x (Float) (defaults to: 0.0)
  • y (Float) (defaults to: 0.0)


# File 'engine_docs/automatic_doc_Coordinates.rb', line 9

Instance Attribute Details

#xFloat

Horizontal component of the vector

Returns:

  • (Float)


# File 'engine_docs/automatic_doc_Coordinates.rb', line 16

#yFloat

Vertical component of the vector

Returns:

  • (Float)


# File 'engine_docs/automatic_doc_Coordinates.rb', line 20

Instance Method Details

#*(scalar) ⇒ Coordinates

Returns the vector multiplied by the scalar value

Parameters:

  • scalar (Float)

Returns:



# File 'engine_docs/automatic_doc_Coordinates.rb', line 36

#+(other) ⇒ Coordinates

Adds the two vectors to a new vector

Parameters:

Returns:



# File 'engine_docs/automatic_doc_Coordinates.rb', line 24

#-(other) ⇒ Coordinates

Subtracts the two vectors to a new vector

Parameters:

Returns:



# File 'engine_docs/automatic_doc_Coordinates.rb', line 30

#dot(other) ⇒ Float

Returns the scalar product of the two vectors

Parameters:

Returns:

  • (Float)


# File 'engine_docs/automatic_doc_Coordinates.rb', line 42

#inspectString

Returns the vector in a easily readable string format

Returns:

  • (String)


# File 'engine_docs/automatic_doc_Coordinates.rb', line 58

#squared_normFloat

Returns the squared norm of the vector

Returns:

  • (Float)


# File 'engine_docs/automatic_doc_Coordinates.rb', line 48

#to_sString

Puts the coordinates in a string

Returns:

  • (String)


# File 'engine_docs/automatic_doc_Coordinates.rb', line 53