geom 0.0.1 → 0.1.0
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 +55 -0
- data/lib/geom/transformation.rb +1 -1
- data/lib/geom/version.rb +1 -1
- metadata +3 -2
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Geom
|
2
|
+
|
3
|
+
A 3D geometry library that includes Point, Vector, Line, Plane, Coordinate System and Transformation objects.
|
4
|
+
|
5
|
+
Geom is not intended for high-performance/volume geometric calculations but rather to simplify geometric calculations.
|
6
|
+
|
7
|
+
## Geometric Entities
|
8
|
+
|
9
|
+
* Point
|
10
|
+
* Vector
|
11
|
+
* Plane
|
12
|
+
* Line
|
13
|
+
* Rectangular Coordinate System
|
14
|
+
* Transformation
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
gem install geom
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Below is an example showing some of the features
|
23
|
+
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
p1 = Geom::Point.new(1,1,0)
|
27
|
+
p2 = Geom::Point.new(9,3,0)
|
28
|
+
|
29
|
+
v1 = Geom::Vector.new(0,1,0)
|
30
|
+
p3 = p1.translate(v1, 10)
|
31
|
+
d1 = p2.distance_to_point(p3)
|
32
|
+
|
33
|
+
pnts = [p1, p2, p3]
|
34
|
+
ave_pnt = Geom::Point.average(pnts)
|
35
|
+
|
36
|
+
pln1 = Geom::Plane.new(p1,p2,p3)
|
37
|
+
p4 = Geom::Point.new(0,0,-10).project_onto_plane(pln1)
|
38
|
+
v2 = pln1.normal
|
39
|
+
|
40
|
+
ln1 = Geom::Line.new(p1,p2)
|
41
|
+
p5 = p3.project_onto_line(ln1)
|
42
|
+
|
43
|
+
rcs = Geom::RectangularCoordinateSystem.new_from_xvector_and_xyplane(p1,v1, v2)
|
44
|
+
t1 = Geom::Transformation.new(rcs)
|
45
|
+
p6 = p3.transform(rcs)
|
46
|
+
```
|
47
|
+
|
48
|
+
## TODO
|
49
|
+
|
50
|
+
* Add new geometric entities: Ray, Line-Segment, Polyline, CircularArc, 2D Shapes (Circle, Triangle, Polygon)
|
51
|
+
* Improve Transformation functionality to include: rotation angle and axis
|
52
|
+
|
53
|
+
## License
|
54
|
+
|
55
|
+
MIT License. Copyright 2011 Ennova.
|
data/lib/geom/transformation.rb
CHANGED
@@ -23,7 +23,7 @@ module Geom
|
|
23
23
|
@type |= TRANSLATION unless self.translation_vector.zero?
|
24
24
|
@type |= SCALING unless self.scale_vector.unitity?
|
25
25
|
|
26
|
-
raise ArgumentError, "Transformation is non-linear" unless self.rotation_submatrix_orthogonal? or self.rotation_submatrix_diagonal
|
26
|
+
raise ArgumentError, "Transformation is non-linear" unless self.rotation_submatrix_orthogonal? or self.rotation_submatrix_diagonal?
|
27
27
|
end
|
28
28
|
|
29
29
|
def type_description
|
data/lib/geom/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: geom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0
|
5
|
+
version: 0.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Adrian Smith
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-01-
|
13
|
+
date: 2012-01-05 00:00:00 +10:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -26,6 +26,7 @@ extra_rdoc_files: []
|
|
26
26
|
files:
|
27
27
|
- .gitignore
|
28
28
|
- Gemfile
|
29
|
+
- README.md
|
29
30
|
- Rakefile
|
30
31
|
- geom.gemspec
|
31
32
|
- lib/geom.rb
|