diff --git a/change.txt b/change.txt index 326e6955..45408c67 100644 --- a/change.txt +++ b/change.txt @@ -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 diff --git a/main/src/georegression/struct/GeoTuple3D_F64.java b/main/src/georegression/struct/GeoTuple3D_F64.java index 43c4fecf..a86c97ed 100644 --- a/main/src/georegression/struct/GeoTuple3D_F64.java +++ b/main/src/georegression/struct/GeoTuple3D_F64.java @@ -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; diff --git a/main/src/georegression/struct/GeoTuple4D_F64.java b/main/src/georegression/struct/GeoTuple4D_F64.java index 70664b7a..cd28408d 100644 --- a/main/src/georegression/struct/GeoTuple4D_F64.java +++ b/main/src/georegression/struct/GeoTuple4D_F64.java @@ -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; @@ -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 ); }