You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A cleaner way to do this is to add a to_array method to the Point2D and Point3D classes along with a from_array classmethod. These methods could then be called in the to_dict and from_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.
The text was updated successfully, but these errors were encountered:
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!
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?
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.The text was updated successfully, but these errors were encountered: