Class: Sunniesnow::Tools::SvgPath::Line

Inherits:
PathSegment show all
Defined in:
lib/sscharter/tools/svg_path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(begin_point, end_point) ⇒ Line

Returns a new instance of Line.

Parameters:



133
134
135
136
137
# File 'lib/sscharter/tools/svg_path.rb', line 133

def initialize begin_point, end_point
	@begin = begin_point
	@end = end_point
	@length = (@end - @begin).length
end

Instance Attribute Details

#beginVector2D (readonly)

Returns:



123
124
125
# File 'lib/sscharter/tools/svg_path.rb', line 123

def begin
  @begin
end

#endVector2D (readonly)

Returns:



126
127
128
# File 'lib/sscharter/tools/svg_path.rb', line 126

def end
  @end
end

#lengthFloat (readonly)

Returns:

  • (Float)


129
130
131
# File 'lib/sscharter/tools/svg_path.rb', line 129

def length
  @length
end

Instance Method Details

#at(t) ⇒ Vector2D

Parameters:

  • t (Float)

Returns:



141
142
143
# File 'lib/sscharter/tools/svg_path.rb', line 141

def at t
	@begin*(1-t) + @end*t
end

#at_length(s) ⇒ Vector2D

Parameters:

  • s (Float)

Returns:



147
148
149
# File 'lib/sscharter/tools/svg_path.rb', line 147

def at_length s
	at s/@length
end