Class: Geom3d::Line
- Inherits:
-
Object
- Object
- Geom3d::Line
- Defined in:
- lib/geom3d/line.rb
Instance Attribute Summary collapse
-
#p1 ⇒ Object
readonly
Returns the value of attribute p1.
-
#p2 ⇒ Object
readonly
Returns the value of attribute p2.
Instance Method Summary collapse
-
#initialize(p1, p2) ⇒ Line
constructor
A new instance of Line.
- #pos(t) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#p1 ⇒ Object (readonly)
Returns the value of attribute p1.
5 6 7 |
# File 'lib/geom3d/line.rb', line 5 def p1 @p1 end |
#p2 ⇒ Object (readonly)
Returns the value of attribute p2.
5 6 7 |
# File 'lib/geom3d/line.rb', line 5 def p2 @p2 end |
Instance Method Details
#pos(t) ⇒ Object
12 13 14 |
# File 'lib/geom3d/line.rb', line 12 def pos t @p1 + t * (@p2 - @p1) end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/geom3d/line.rb', line 16 def to_s "Line(#{@p1.to_s}, #{@p2.to_s})" end |