Skip to content

Commit

Permalink
fix: adding ones column for constraints when weights missing
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlangrose committed Jun 4, 2024
1 parent 72e2f06 commit 44cc8fb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions LoopStructural/interpolators/_geological_interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def set_value_constraints(self, points: np.ndarray):
"""
points = self.check_array(points)
if points.shape[1] == 4:
points = np.hstack([points, np.ones((points.shape[0], 1))])
if points.shape[1] < 5:
raise ValueError("Value points must at least have X,Y,Z,val,w")
self.data["value"] = points
Expand All @@ -125,7 +127,9 @@ def set_gradient_constraints(self, points: np.ndarray):
-------
"""
if points.shape[1] < 6:
if points.shape[1] == 6:
points = np.hstack([points, np.ones((points.shape[0], 1))])
if points.shape[1] < 7:
raise ValueError("Gradient constraints must at least have X,Y,Z,gx,gy,gz")
self.n_g = points.shape[0]
self.data["gradient"] = points
Expand All @@ -144,7 +148,9 @@ def set_normal_constraints(self, points: np.ndarray):
-------
"""
if points.shape[1] < 6:
if points.shape[1] == 6:
points = np.hstack([points, np.ones((points.shape[0], 1))])
if points.shape[1] < 7:
raise ValueError("Nonrmal constraints must at least have X,Y,Z,nx,ny,nz")
self.n_n = points.shape[0]
self.data["normal"] = points
Expand All @@ -163,7 +169,9 @@ def set_tangent_constraints(self, points: np.ndarray):
-------
"""
if points.shape[1] < 6:
if points.shape[1] == 6:
points = np.hstack([points, np.ones((points.shape[0], 1))])
if points.shape[1] < 7:
raise ValueError("Tangent constraints must at least have X,Y,Z,tx,ty,tz")
self.data["tangent"] = points
self.up_to_date = False
Expand Down

0 comments on commit 44cc8fb

Please sign in to comment.