This commit is contained in:
oguzhankoral 2023-11-27 23:36:10 +03:00
Родитель ec0c9066d2
Коммит 2d67815ae6
1 изменённых файлов: 0 добавлений и 19 удалений

Просмотреть файл

@ -22,16 +22,6 @@ module SpeckleConnector
merged_faces(faces)
end
def self.merge_coplanar_faces_2(faces)
edges = []
faces.each { |face| face.edges.each { |edge| edges << edge } }
edges.uniq!
edges.each { |edge| remove_edge_have_coplanar_faces(edge, faces, false) }
# Remove remaining orphan edges
# edges.reject(&:deleted?).select { |edge| edge.faces.empty? }.each(&:erase!)
merged_faces(faces)
end
def self.merged_faces(faces)
faces.reject(&:deleted?)
end
@ -50,18 +40,10 @@ module SpeckleConnector
# @param ignore_materials [Boolean] whether ignore materials or not.
# Returns true if the given edge separating two coplanar faces.
# Return false otherwise.
# rubocop:disable Metrics/AbcSize
def self.remove_edge_have_coplanar_faces(edge, faces, ignore_materials)
return false unless edge.valid? && edge.is_a?(Sketchup::Edge)
return false unless edge.faces.size == 2
# Check scoped faces have this edges
# if edge.faces.size == 2
# is_first = faces.include?(edge.faces[0])
# is_second = faces.include?(edge.faces[1])
# return false unless is_first && is_second
# end
face_1, face_2 = edge.faces
return false unless face_1.normal.samedirection?(face_2.normal)
@ -83,7 +65,6 @@ module SpeckleConnector
edge.erase!
true
end
# rubocop:enable Metrics/AbcSize
# Determines if two faces are overlapped.
def self.face_duplicate?(face_1, face_2, overlapping: false)