66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/rgeo/geographic/spherical_feature_methods.rb', line 66
def is_simple?
arcs_ = _arcs
len_ = arcs_.length
return false if arcs_.any?{ |a_| a_.degenerate? }
return true if len_ == 1
return arcs_[0].s != arcs_[1].e if len_ == 2
arcs_.each_with_index do |arc_, index_|
nindex_ = index_ + 1
nindex_ = nil if nindex_ == len_
return false if nindex_ && arc_.contains_point?(arcs_[nindex_].e)
pindex_ = index_ - 1
pindex_ = nil if pindex_ < 0
return false if pindex_ && arc_.contains_point?(arcs_[pindex_].s)
if nindex_
oindex_ = nindex_ + 1
while oindex_ < len_
oarc_ = arcs_[oindex_]
return false if !(index_ == 0 && oindex_ == len_-1 && arc_.s == oarc_.e) && arc_.intersects_arc?(oarc_)
oindex_ += 1
end
end
end
true
end
|