Closed chriswmackey closed 4 years ago
Hi @chriswmackey
This is ready, but don't want to commit until we close the other PR.
One comment, I placed the from_array
and to_array
functions in the Vector2D
and Vector3D
classes since I see we can use this in vectors as well. It is inherited by the point classes. Hope this makes sense!
@santiagogaray ,
Thanks for taking care of this. As long as your changes here don't involve any changes to the Sphere3D
class, there actually won't be any conflicts if you send another PR alongside your current one. In other words, when you send a PR, Github is only merging in the changes to files; not the files themselves. Still, I realize that jumping back and forth between two copies of the code on your local machine can get annoying. Do you want to just split up your Sphere3D
tests as part of your new PR and we can merge your old one in?
The other PR has been merged. Feel free to send the new one once you get the chance to rebase your fork and sommit your local changes.
This issue was addressed via https://github.com/ladybug-tools/ladybug-geometry/pull/78
This is a simple change that will make the
to_dict
andfrom_dict
code cleaner across all of the geometry objects.A lot of the dictionary representations of objects represent point data as arrays of 2 or 3 values, such as that which you see here for Face3D: https://github.com/ladybug-tools/ladybug-geometry/blob/master/ladybug_geometry/geometry3d/face.py#L150
A cleaner way to do this is to add a
to_array
method to thePoint2D
andPoint3D
classes along with afrom_array
classmethod. These methods could then be called in theto_dict
andfrom_dict
methods of each of the other objects that represent point data as arrays. This should minimize the amount of duplicate code that we have across all of the geometry objects, which is basically just converting the point object to an array.