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

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.

Parameters:

  • objects1 (Array)

    Array

  • objects2 (Array)

    Array

Returns:

  • (Integer)

    Returns offset between objects2 and objects1 or nil



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

.normal_tolObject

Tolerance for normal vector checks



30
31
32
# File 'lib/topolys/model.rb', line 30

def Topolys.normal_tol
  @@normal_tol
end

.planar_tolObject

Tolerance for planarity checks



35
36
37
# File 'lib/topolys/model.rb', line 35

def Topolys.planar_tol
  @@planar_tol
end