Class: SkippyLib::Line

Inherits:
Array
  • Object
show all
Defined in:
modules/line.rb

Overview

Since:

  • 3.0.0

Instance Method Summary collapse

Constructor Details

#initialize(point, vector) ⇒ Line

Returns a new instance of Line.

Parameters:

  • point (Geom::Point3d)
  • vector (Geom::Vector3d)

Since:

  • 3.0.0



10
11
12
13
14
15
# File 'modules/line.rb', line 10

def initialize(point, vector)
  super()
  # Not making type check or type conversion due to performance.
  push(point)
  push(vector)
end

Instance Method Details

#directionGeom::Vector3d

Returns:

  • (Geom::Vector3d)

Since:

  • 3.0.0



19
20
21
# File 'modules/line.rb', line 19

def direction
  @direction ||= direction_internal
end

#inspectString

Returns:

  • (String)

Since:

  • 3.0.0



36
37
38
# File 'modules/line.rb', line 36

def inspect
  "#{self.class.name}#{super}"
end

#to_aArray(Geom::Point3d, Geom::Vector3d)

Returns:

  • (Array(Geom::Point3d, Geom::Vector3d))

Since:

  • 3.0.0



25
26
27
# File 'modules/line.rb', line 25

def to_a
  [at(0).clone, direction]
end

#valid?Boolean

Returns:

  • (Boolean)

Since:

  • 3.0.0



30
31
32
# File 'modules/line.rb', line 30

def valid?
  valid_point3d?(at(0)) && (valid_point3d?(at(1)) || valid_vector3d?(at(1)))
end