Class: Pulo::Prism
- Inherits:
-
Object
- Object
- Pulo::Prism
- Includes:
- Figure3D
- Defined in:
- lib/pulo/figure/figure3d.rb
Instance Attribute Summary collapse
-
#face ⇒ Object
readonly
Returns the value of attribute face.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#side_areas ⇒ Object
readonly
Returns the value of attribute side_areas.
Attributes included from Figure3D
Instance Method Summary collapse
-
#initialize(face: nil, length: nil) ⇒ Prism
constructor
A new instance of Prism.
Methods included from Quantity_Checker
Constructor Details
#initialize(face: nil, length: nil) ⇒ Prism
135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/pulo/figure/figure3d.rb', line 135 def initialize(face: nil, length: nil) quantity_check [face,Triangle] ,[length,Length] raise 'Prism needs a face and length.' unless face && length @face=face @length=length @volume=@face.area*@length @side_areas=[] @side_areas[0]=@face.lengths[0]*@length @side_areas[1]=@face.lengths[1]*@length @side_areas[2]=@face.lengths[2]*@length @surfacearea=@face.area*2+@side_areas[0]+@side_areas[1]+@side_areas[2] end |
Instance Attribute Details
#face ⇒ Object (readonly)
Returns the value of attribute face.
133 134 135 |
# File 'lib/pulo/figure/figure3d.rb', line 133 def face @face end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
133 134 135 |
# File 'lib/pulo/figure/figure3d.rb', line 133 def length @length end |
#side_areas ⇒ Object (readonly)
Returns the value of attribute side_areas.
134 135 136 |
# File 'lib/pulo/figure/figure3d.rb', line 134 def side_areas @side_areas end |