Skip to content

Instantly share code, notes, and snippets.

@bgschiller
Last active September 14, 2017 17:15
Show Gist options
  • Select an option

  • Save bgschiller/5273adedad5ea35a03cf608f3bd7cbd2 to your computer and use it in GitHub Desktop.

Select an option

Save bgschiller/5273adedad5ea35a03cf608f3bd7cbd2 to your computer and use it in GitHub Desktop.

Problem

When a space is moved, or added to, or another space is drawn next to it (causing edges to split), the edge_ids will change. Since windows are associated by reference to an edge, we need some way to carry them along.

https://trello-attachments.s3.amazonaws.com/58d428743111af1d0a20cf28/59baa7fa1003db0d685fc7a0/37a7ba47d5740ae4fbe36658858e9fda/recording.webm

Notes from NREL

NatLabRockies/floorspace.js#17

If an edge is deleted, then windows on that edge are deleted.

If an edge is resized, windows should stay in the same absolute location. If a window's alpha parameter becomes <= 0 or >= 1 the window should be deleted.

If an edge is broken into two pieces (e.g. by inserting a vertex), windows should be moved to the correct edge such that alpha remains <= 0 or >= 1

Solutions

Record and Replace

What if we record the locations of all components before a replaceFacePoints, then put them back as if we were creating them anew after the new face exists.

Issues

map from old_edge_id to new_edge_id

Somehow figure out a mapping from the existing edges to the replacements. Go through and update the windows to refer to the new edges.

Issues

Code where this might live:

// src/store/modules/geometry/actions/actions.js
replaceFacePoints(context, { geometry_id, face_id, vertices, edges }) {
  // get all components
  context.commit('replaceFacePoints', {
    geometry_id,
    face_id,
    // the new geometry that is replacing the existing stuff.
    vertices,
    edges,
  });
  // replay the components
},
@wintersieck
Copy link
Copy Markdown

do the record and replace, but only put an edge back if it's going to live on the same face as when we started.
When we run moveByOffset, replace with an offset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment