Skip to content

Commit

Permalink
fix(face3d): Changing validate_planarity to check_planar
Browse files Browse the repository at this point in the history
The word "check" is a lot more generic and easier to remember than "validate".  So I changed all of the checking functions in honeybee-core to use the word "check" instead of "validate".  Now I am changing ladybug-geometry to follow the same convention.
  • Loading branch information
chriswmackey authored and Chris Mackey committed Aug 12, 2019
1 parent 9339f9e commit feabc59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions ladybug_geometry/geometry3d/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def is_valid(self):
"""Boolean noting whether the face is valid (having a non-zero area).
Note that faces are still considered valid if they have out-of-plane vertices,
self-intersecting edges, or duplicate/colinear vertices. The validate_planarity
self-intersecting edges, or duplicate/colinear vertices. The check_planar
method can be used to detect if there are out-of-plane vertices. The
is_self_intersecting property identifies self-intersecting edges, and the
remove_colinear_vertices method will remove duplicate/colinear vertices."""
Expand Down Expand Up @@ -654,8 +654,8 @@ def is_sub_face(self, face, tolerance, angle_tolerance):
return False
return True

def validate_planarity(self, tolerance, raise_exception=True):
"""Validate that all of the face's vertices lie within the face's plane.
def check_planar(self, tolerance, raise_exception=True):
"""Check that all of the face's vertices lie within the face's plane.
This check is not done by default when creating the face since
it is assumed that there is likely a check for planarity before the face
Expand Down
16 changes: 8 additions & 8 deletions tests/face3d_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ def test_triangulated_mesh_and_centroid():
assert face_2.centroid.z == 0


def test_validate_planarity():
"""Test the validate_planarity method of Face3D."""
def test_check_planar():
"""Test the check_planar method of Face3D."""
pts_1 = (Point3D(0, 0, 2), Point3D(2, 0, 2), Point3D(2, 2, 2), Point3D(0, 2, 2))
pts_2 = (Point3D(0, 0, 0), Point3D(2, 0, 2), Point3D(2, 2, 2), Point3D(0, 2, 2))
pts_3 = (Point3D(0, 0, 2.0001), Point3D(2, 0, 2), Point3D(2, 2, 2), Point3D(0, 2, 2))
Expand All @@ -585,14 +585,14 @@ def test_validate_planarity():
face_2 = Face3D(pts_2, plane_1)
face_3 = Face3D(pts_3, plane_1)

assert face_1.validate_planarity(0.001) is True
assert face_2.validate_planarity(0.001, False) is False
assert face_1.check_planar(0.001) is True
assert face_2.check_planar(0.001, False) is False
with pytest.raises(Exception):
face_2.validate_planarity(0.0001)
assert face_3.validate_planarity(0.001) is True
assert face_3.validate_planarity(0.000001, False) is False
face_2.check_planar(0.0001)
assert face_3.check_planar(0.001) is True
assert face_3.check_planar(0.000001, False) is False
with pytest.raises(Exception):
face_3.validate_planarity(0.000001)
face_3.check_planar(0.000001)


def test_flip():
Expand Down

0 comments on commit feabc59

Please sign in to comment.