Class: XRVG::LinearBezier

Inherits:
BezierMotif show all
Defined in:
lib/beziermotifs.rb

Overview

LinearBezier class

Content

Build an line bezier whose base is specified by two points.

Attributes

None, apart from :support

Example

line = LinearBezier[ :support, [V2D::O, V2D::X] ]

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BezierMotif

build

Methods inherited from BezierBuilder

[], build, lissage

Class Method Details

.buildwithangle(angle) ⇒ Object

Utilitary method to build a unit bezier line with angle



115
116
117
# File 'lib/beziermotifs.rb', line 115

def LinearBezier.buildwithangle( angle )
  return LinearBezier[ :support, [V2D::O, V2D::X.rotate( angle )]]
end

Instance Method Details

#computeObject

BezierBuilder compute overloading.

See code for algorithm



109
110
111
112
# File 'lib/beziermotifs.rb', line 109

def compute
  p1, p2 = self.support
  return [[:vector, p1, (p2-p1) * 1.0 / 3.0,  p2, (p1 - p2) * 1.0 / 3.0]]
end