Class: StructuraidCore::Engineering::Locations::Absolute

Inherits:
Base
  • Object
show all
Defined in:
lib/structuraid_core/engineering/locations/absolute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value_x:, value_y:, value_z:) ⇒ Absolute

Returns a new instance of Absolute.



9
10
11
12
13
# File 'lib/structuraid_core/engineering/locations/absolute.rb', line 9

def initialize(value_x:, value_y:, value_z:)
  @value_x = value_x.to_f
  @value_y = value_y.to_f
  @value_z = value_z.to_f
end

Instance Attribute Details

#value_xObject (readonly)

Returns the value of attribute value_x.



7
8
9
# File 'lib/structuraid_core/engineering/locations/absolute.rb', line 7

def value_x
  @value_x
end

#value_yObject (readonly)

Returns the value of attribute value_y.



7
8
9
# File 'lib/structuraid_core/engineering/locations/absolute.rb', line 7

def value_y
  @value_y
end

#value_zObject (readonly)

Returns the value of attribute value_z.



7
8
9
# File 'lib/structuraid_core/engineering/locations/absolute.rb', line 7

def value_z
  @value_z
end

Instance Method Details

#to_matrixObject



15
16
17
18
19
20
21
22
23
# File 'lib/structuraid_core/engineering/locations/absolute.rb', line 15

def to_matrix
  Matrix.column_vector(
    [
      value_x,
      value_y,
      value_z
    ]
  )
end

#to_vectorObject



25
26
27
# File 'lib/structuraid_core/engineering/locations/absolute.rb', line 25

def to_vector
  Vector[value_x, value_y, value_z]
end