unit_quaternion 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -5,10 +5,17 @@ class that is designed to be used to represent rotations.
5
5
 
6
6
  ## Installation
7
7
 
8
- This package is not available through any gem repository (yet).
9
- Install it using:
8
+ You can install this gem in either of the following ways:
10
9
 
10
+ ```
11
+ $ sudo gem install unit_quaternion
12
+ ```
13
+
14
+ or
15
+
16
+ ```
11
17
  $ sudo rake install
18
+ ```
12
19
 
13
20
  ## Usage
14
21
 
@@ -19,6 +26,7 @@ require 'unit_quaternion'
19
26
 
20
27
  You can perform basic quaternion operations, such as addition and multiplication:
21
28
 
29
+ ```
22
30
  q1 = Quaternion.new(1,2,3,4)
23
31
  => (1, Vector[2, 3, 4])
24
32
 
@@ -30,42 +38,55 @@ q1 + q2
30
38
 
31
39
  q1 * q2
32
40
  => (-12, Vector[6, 24, 12])
41
+ ```
33
42
 
34
43
  You can use the UnitQuaternion class to represent spatial rotations.
35
44
  The following represents a rotation of PI/2 radians about the x-axis:
36
45
 
46
+ ```
37
47
  qx = UnitQuaternion.fromAngleAxis(Math::PI/2, Vector[1, 0, 0])
38
48
  => (0.7071067811865476, Vector[0.7071067811865475, 0.0, 0.0])
49
+ ```
39
50
 
40
51
  The following represents a rotation of PI/2 radians about the y-axis:
41
52
 
53
+ ```
42
54
  qy = UnitQuaternion.fromAngleAxis(Math::PI/2, Vector[0, 1, 0])
43
55
  => (0.7071067811865476, Vector[0.0, 0.7071067811865475, 0.0])
56
+ ```
44
57
 
45
58
  You can use quaternion multiplication to compose rotations. If we
46
59
  want to find the quaternion describing a rotation about the body-fixed
47
60
  x-axis, followed by a rotation about the body-fixed y-axis, we would
48
61
  do the following:
49
62
 
63
+ ```
50
64
  q = qx * qy
51
65
  => (0.5000000000000001, Vector[0.5, 0.5, 0.4999999999999999])
66
+ ```
52
67
 
53
68
  Notice that this is the same as:
54
69
 
70
+ ```
55
71
  q = UnitQuaternion.fromEuler(Math::PI/2, Math::PI/2, 0, 'xyz')
56
72
  => (0.5000000000000001, Vector[0.5, 0.5, 0.4999999999999999])
73
+ ```
57
74
 
58
75
  If we want to find the quaternion describing a rotation the inertial
59
76
  x-axis, followed by a rotation about the inertial y-axis, we would do
60
77
  the following:
61
78
 
79
+ ```
62
80
  q = qy * qx
63
81
  => (0.5000000000000001, Vector[0.5, 0.5, -0.4999999999999999])
82
+ ```
64
83
 
65
84
  Notice that this is the same as:
66
85
 
86
+ ```
67
87
  q = UnitQuaternion.fromEuler(Math::PI/2, Math::PI/2, 0, 'XYZ')
68
88
  => (0.5000000000000001, Vector[0.5, 0.5, -0.4999999999999999])
89
+ ```
69
90
 
70
91
  Additionally, you can use the method fromRotationMatrix to set the
71
92
  values of the quaternion from an orthonormal 3x3 matrix. Finally, you
@@ -77,6 +98,7 @@ The transform method takes a vector as an argument and returns the
77
98
  result of rotating that vector through the rotation described by the
78
99
  quaternion. For example:
79
100
 
101
+ ```
80
102
  q = UnitQuaternion.fromAngleAxis(Math::PI/2, Vector[0, 0, 1])
81
103
  => (0.7071067811865476, Vector[0.0, 0.0, 0.7071067811865475])
82
104
 
@@ -85,6 +107,7 @@ v = Vector[1, 0, 0]
85
107
 
86
108
  q.transform(v)
87
109
  => Vector[2.220446049250313e-16, 1.0, 0.0]
110
+ ```
88
111
 
89
112
  gives the result of rotating the vector (1, 0, 0) through PI/2 radians
90
113
  about the z-axis.
@@ -1,3 +1,3 @@
1
1
  module Quaternion
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["cory.crean@gmail.com"]
11
11
  spec.description = %q{Provides a general Quaternion class, and UnitQuaternion class to represent rotations}
12
12
  spec.summary = spec.description
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/ccrean/Quaternion_ruby"
14
14
  spec.license = "BSD"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unit_quaternion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-02 00:00:00.000000000 Z
12
+ date: 2016-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -95,7 +95,7 @@ files:
95
95
  - tests/tests_Quaternion.rb
96
96
  - tests/tests_UnitQuaternion.rb
97
97
  - unit_quaternion.gemspec
98
- homepage: ''
98
+ homepage: https://github.com/ccrean/Quaternion_ruby
99
99
  licenses:
100
100
  - BSD
101
101
  post_install_message: