lib/measures/tbd/resources/model.rb
def split_wire(wire, directed_edge, offset, new_directed_edge)

      directed_edges = wire.directed_edges

      index = directed_edges.index{|de| de.id == directed_edge.id}
      return nil if !index

      directed_edges.insert(index + offset, new_directed_edge)

      # simulate friend access to set directed_edges on wire
      wire.instance_variable_set(:@directed_edges, directed_edges)
      wire.recalculate

      # no need to update faces referencing this wire
    end
##
# Inserts new directed edge after directed edge in wire
#
# @param [Wire] wire Existing wire
# @param [DirectedEdge] directed_edge Existing directed edge
# @param [Integer] offset 0 to insert new_directed_edge edge before directed_edge, 1 to insert after
# @param [DirectedEdge] directed_edge New directed edge to insert
Inserts new directed edge after directed edge in wire
Inserts new directed edge after directed edge in wire
def split_wire(wire, directed_edge, offset, new_directed_edge)
      directed_edges = wire.directed_edges
      index = directed_edges.index{|de| de.id == directed_edge.id}
      return nil if !index
      directed_edges.insert(index + offset, new_directed_edge)
      wire.instance_variable_set(:@directed_edges, directed_edges)
      wire.recalculate
    end
def split_wire ( wire , directed_edge , offset , new_directed_edge ) directed_edges = wire . directed_edges index = directed_edges . index { | de | de . id == directed_edge . id } return nil if ! index directed_edges . insert ( index + offset , new_directed_edge ) wire . instance_variable_set ( :@directed_edges , directed_edges ) wire . recalculate end
Inserts new directed edge after directed edge in wire
Inserts new directed edge after directed edge in wire
# simulate friend access to set directed_edges on wire # no need to update faces referencing this wire
wire
directed_edge
offset
new_directed_edge
directed_edge New directed edge to insert
directed_edge New directed edge to insert