Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 1.12 KB

README.md

File metadata and controls

40 lines (28 loc) · 1.12 KB

Matrix Transformation for Ruby Interactive Shell

Usage

  1. Download File or Clone Repository
  2. Start Ruby Shell:
irb -r ./transformation.rb

Documentation

Global Methods

T(x,y,z) generates a Translation Matrix.
S(x,y,z) generates a Scale Matrix.
R(angle: , axis: ) generates a Rotation Matrix.

T(1, 1, 1)
S(2, 2, 2)
R(angle: 90, axis: 'x')

angle specifies the angle in degrees.
axis specifies the Axis. Can be either ('x', 'y', 'z').

In addition to these, there is one Method for Points.
P(x,y,z) generates a 4x1 Matrix. The fourth Value will be by default 1 but can be specified.

Keep in Mind that something like S(1/3, 1/3, 1/3) in Ruby will be converted to S(0,0,0) due to Integer. You need to use float for that kind.

Internal Methods

There are some 'internal' Methods which are for internal use but may be used like any other Method.

Integer to_r The class Integer has a Method to_r which will assume the number is in degrees and coverts it into radians.

Matrix to_s Defines the Look of the standard Ouput of a Matrix. Does not work yet.