arpastrana / compas_cem

Inverse design of 3D truss networks with automatic differentiation
https://arpastrana.github.io/compas_cem
MIT License
37 stars 7 forks source link

Edge objects mix up xyz coordinates and node keys as u, v attributes #1

Open arpastrana opened 4 years ago

arpastrana commented 4 years ago

Feature Request

We need to clean up how Edge objects are created.

Details

Make Edge objects is confusing as xyz coordinates or int keys can be stored in their self.u and self.v attributes. A solution to this would be like what is happening with the Node class, where there is self.xyz and self.key attributes in the constructor (both initialized to None at runtime). When Node.from_point is invoked, node.xyz is repointed to the supplied point, and node.key stays dormant. The converse is true when a node is instantiated from a key (which should be the de-facto way).

The trick comes when adding an Edge to a Diagram, where the latter should handle the addition adequately upon encountering an edge with u, v keys only, or xyz coordinates only, or a combination of the two.