summaryrefslogtreecommitdiff
path: root/CSMath/src/bezier/geom/transform/TDHShear.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2018-05-23 16:42:38 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2018-05-23 16:42:38 -0400
commit48f781fb6e61539ba9d17efcfd9f9e38245cf6c0 (patch)
tree97e5743678a00d09024ec040490b8fcf8ccb1c74 /CSMath/src/bezier/geom/transform/TDHShear.java
parent81d8191c01629d881486f1f1fe5ae16c42b46287 (diff)
Refactor package structure
Diffstat (limited to 'CSMath/src/bezier/geom/transform/TDHShear.java')
-rw-r--r--CSMath/src/bezier/geom/transform/TDHShear.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/CSMath/src/bezier/geom/transform/TDHShear.java b/CSMath/src/bezier/geom/transform/TDHShear.java
new file mode 100644
index 0000000..f099e74
--- /dev/null
+++ b/CSMath/src/bezier/geom/transform/TDHShear.java
@@ -0,0 +1,59 @@
+package bezier.geom.transform;
+
+import bezier.geom.TDHPoint;
+
+public class TDHShear implements TDHTransform {
+ public final double shx;
+ public final double shy;
+
+ @Override
+ public TDHTransformType type() {
+ return TDHTransformType.SHEAR;
+ }
+
+ public TDHShear(double shx, double shy) {
+ this.shx = shx;
+ this.shy = shy;
+ }
+
+ @Override
+ public TDHPoint transform(TDHPoint punkt) {
+ double x = punkt.x + (punkt.y * shx);
+ double y = punkt.y + (punkt.x * shy);
+
+ return new TDHPoint(x, y, punkt.z);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(shx);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(shy);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TDHShear other = (TDHShear) obj;
+ if (Double.doubleToLongBits(shx) != Double.doubleToLongBits(other.shx))
+ return false;
+ if (Double.doubleToLongBits(shy) != Double.doubleToLongBits(other.shy))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "TDHShear [shx=" + shx + ", shy=" + shy + "]";
+ }
+} \ No newline at end of file