Skip to content

Commit

Permalink
- GeoTuple
Browse files Browse the repository at this point in the history
 * Provided setTo() where you can assign it from a lower dimension
  • Loading branch information
lessthanoptimal committed Oct 15, 2023
1 parent e6dda20 commit befd63b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
7 changes: 7 additions & 0 deletions change.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
YEAR-MONTH-DAY

---------------------------------------------
Date : 2023-??
Version : 0.26.3

- GeoTuple
* Provided setTo() where you can assign it from a lower dimension

---------------------------------------------
Date : 2023-Sep-24
Version : 0.26.2
Expand Down
7 changes: 7 additions & 0 deletions main/src/georegression/struct/GeoTuple3D_F64.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ protected void _setTo( GeoTuple3D_F64 a ) {
z = a.z;
}

public T setTo( GeoTuple2D_F64<?> p, double z ) {
this.x = p.x;
this.y = p.y;
this.z = z;
return (T)this;
}

public T setTo( double x, double y, double z ) {
this.x = x;
this.y = y;
Expand Down
18 changes: 13 additions & 5 deletions main/src/georegression/struct/GeoTuple4D_F64.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ protected void _setTo(GeoTuple4D_F64 a ) {
w = a.w;
}

public T setTo( GeoTuple3D_F64<?> p, double w ) {
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.w = w;
return (T)this;
}

public T setTo(double x, double y, double z , double w ) {
this.x = x;
this.y = y;
Expand All @@ -78,16 +86,16 @@ public boolean isIdentical( double x, double y, double z , double w ) {
}

public boolean isIdentical( double x, double y, double z, double w , double tol ) {
return ( Math.abs( this.x - x ) <= tol &&
Math.abs( this.y - y ) <= tol &&
Math.abs( this.z - z ) <= tol &&
return ( Math.abs( this.x - x ) <= tol &&
Math.abs( this.y - y ) <= tol &&
Math.abs( this.z - z ) <= tol &&
Math.abs( this.w - w ) <= tol );
}

@Override
public boolean isIdentical( GeoTuple4D_F64 t, double tol ) {
return ( Math.abs( this.x - t.x ) <= tol &&
Math.abs( this.y - t.y ) <= tol &&
return ( Math.abs( this.x - t.x ) <= tol &&
Math.abs( this.y - t.y ) <= tol &&
Math.abs( this.z - t.z ) <= tol &&
Math.abs( this.w - t.w ) <= tol );
}
Expand Down

0 comments on commit befd63b

Please sign in to comment.