Skip to content

Commit

Permalink
Merge pull request #193 from Loop3D/constraints
Browse files Browse the repository at this point in the history
fix: weights for vector constraints are optional
  • Loading branch information
lachlangrose authored Jun 4, 2024
2 parents 078b3e5 + 44cc8fb commit 7f976b8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 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,6 +127,8 @@ def set_gradient_constraints(self, points: np.ndarray):
-------
"""
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]
Expand All @@ -144,6 +148,8 @@ def set_normal_constraints(self, points: np.ndarray):
-------
"""
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]
Expand All @@ -163,6 +169,8 @@ def set_tangent_constraints(self, points: np.ndarray):
-------
"""
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
Expand Down

0 comments on commit 7f976b8

Please sign in to comment.