Module: Topolys
- Defined in:
- lib/topolys/model.rb,
lib/topolys/version.rb,
lib/topolys/geometry.rb,
lib/topolys/transformation.rb
Overview
TODO : start integrating warning logs à la raise …
Defined Under Namespace
Classes: BoundingBox, DirectedEdge, Edge, Face, Model, Object, Plane3D, Point3D, Shell, Transformation, Vector3D, Vertex, Wire
Constant Summary collapse
- VERSION =
"0.6.2"
- @@normal_tol =
0.000001
- @@planar_tol =
0.01
Class Method Summary collapse
-
.find_offset(objects1, objects2) ⇒ Integer
Checks if one array of objects is the same as another array of objects.
-
.normal_tol ⇒ Object
Tolerance for normal vector checks.
-
.planar_tol ⇒ Object
Tolerance for planarity checks.
Class Method Details
.find_offset(objects1, objects2) ⇒ Integer
Checks if one array of objects is the same as another array of objects. The order of objects must be the same but the two arrays may start at different indices.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/topolys/model.rb', line 47 def Topolys.find_offset(objects1, objects2) n = objects1.size return nil if objects2.size != n offset = objects2.index{|obj| objects1[0].id == obj.id} return nil if !offset objects1.each_index do |i| return nil if objects1[i].id != objects2[(offset+i)%n].id end return offset end |