diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-10-14 11:42:53 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-10-14 11:42:53 -0400 |
| commit | 8f42378c707c8c962082e394fe67ac3bb5cd557b (patch) | |
| tree | 9b4070c764b8d0ed792d9f79a66fc169a237b949 /CSMath/src/bezier/transforms | |
| parent | f778a81e81506a4db455a6f506571c6bba935bf2 (diff) | |
General cleanup
Diffstat (limited to 'CSMath/src/bezier/transforms')
13 files changed, 0 insertions, 717 deletions
diff --git a/CSMath/src/bezier/transforms/geom/TDHCombination.java b/CSMath/src/bezier/transforms/geom/TDHCombination.java deleted file mode 100644 index 22a0b40..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHCombination.java +++ /dev/null @@ -1,64 +0,0 @@ -package bezier.transforms.geom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import bezier.geom.TDHPoint;
-
-public class TDHCombination implements TDHTransform {
- public final List<TDHTransform> forms;
-
- @Override
- public TDHTransformType type() {
- return TDHTransformType.COMBINATION;
- }
-
- public TDHCombination(TDHTransform... forms) {
- this.forms = new ArrayList<>(forms.length);
-
- for (TDHTransform form : forms) {
- this.forms.add(form);
- }
- }
-
- @Override
- public TDHPoint transform(TDHPoint punkt) {
- TDHPoint ret = punkt;
-
- for (TDHTransform form : forms) {
- ret = form.transform(ret);
- }
-
- return ret;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((forms == null) ? 0 : forms.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- TDHCombination other = (TDHCombination) obj;
- if (forms == null) {
- if (other.forms != null)
- return false;
- } else if (!forms.equals(other.forms))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "TDHCombination [forms=" + forms + "]";
- }
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHIdentity.java b/CSMath/src/bezier/transforms/geom/TDHIdentity.java deleted file mode 100644 index f24d1c9..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHIdentity.java +++ /dev/null @@ -1,21 +0,0 @@ -package bezier.transforms.geom;
-
-import bezier.geom.TDHPoint;
-
-/**
- * A transform that does nothing.
- *
- * @author bjculkin
- *
- */
-public class TDHIdentity implements TDHTransform {
- @Override
- public TDHPoint transform(TDHPoint punkt) {
- return punkt;
- }
-
- @Override
- public String toString() {
- return "TDHIdentity []";
- }
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHLineReflection.java b/CSMath/src/bezier/transforms/geom/TDHLineReflection.java deleted file mode 100644 index cf1e8c2..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHLineReflection.java +++ /dev/null @@ -1,68 +0,0 @@ -package bezier.transforms.geom;
-
-import bezier.geom.TDHPoint;
-
-public class TDHLineReflection implements TDHTransform {
- public final double a;
- public final double b;
- public final double c;
-
- public TDHLineReflection(double a, double b, double c) {
- this.a = a;
- this.b = b;
- this.c = c;
- }
-
- @Override
- public TDHTransformType type() {
- return TDHTransformType.REFLECTION;
- }
-
- @Override
- public TDHPoint transform(TDHPoint punkt) {
- double com = (a * a - b * b);
-
- double x = (punkt.x * com) - (2 * a * b * punkt.y) - (2 * a * c * punkt.z);
- double y = (-2 * a * b * punkt.x) + (punkt.y * com) - (2 * b * c * punkt.z);
- double z = (punkt.z * com);
-
- return new TDHPoint(x, y, z);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- long temp;
- temp = Double.doubleToLongBits(a);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(b);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(c);
- 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;
- TDHLineReflection other = (TDHLineReflection) obj;
- if (Double.doubleToLongBits(a) != Double.doubleToLongBits(other.a))
- return false;
- if (Double.doubleToLongBits(b) != Double.doubleToLongBits(other.b))
- return false;
- if (Double.doubleToLongBits(c) != Double.doubleToLongBits(other.c))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "TDHLineReflection [a=" + a + ", b=" + b + ", c=" + c + "]";
- }
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHMatrixTransform.java b/CSMath/src/bezier/transforms/geom/TDHMatrixTransform.java deleted file mode 100644 index ace590d..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHMatrixTransform.java +++ /dev/null @@ -1,32 +0,0 @@ -package bezier.transforms.geom;
-
-import bezier.geom.Matrix;
-import bezier.geom.TDHPoint;
-
-public class TDHMatrixTransform implements TDHTransform {
- public final Matrix mat;
-
- public TDHMatrixTransform(Matrix mat) {
- this.mat = mat;
- }
-
- public TDHMatrixTransform(double[][] mat) {
- this.mat = new Matrix(mat);
- }
-
- @Override
- public TDHTransformType type() {
- return TDHTransformType.MATRIX;
- }
-
- @Override
- public TDHPoint transform(TDHPoint punkt) {
- double[] mult = mat.scalarMultiply(new double[] { punkt.x, punkt.y, punkt.z });
-
- return new TDHPoint(mult[0], mult[1], mult[2]);
- }
-
- public TDHTransform then(TDHMatrixTransform trans) {
- return new TDHMatrixTransform(mat.multiply(trans.mat));
- }
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHPointRotation.java b/CSMath/src/bezier/transforms/geom/TDHPointRotation.java deleted file mode 100644 index bc3c716..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHPointRotation.java +++ /dev/null @@ -1,67 +0,0 @@ -package bezier.transforms.geom;
-
-import bezier.geom.TDHPoint;
-
-public class TDHPointRotation extends TDHRotation {
- public final double x0;
- public final double y0;
-
- public TDHPointRotation(double theta, double x0, double y0) {
- super(theta);
-
- this.x0 = x0;
- this.y0 = y0;
- }
-
- @Override
- public TDHTransformType type() {
- return TDHTransformType.ROTATION;
- }
-
- @Override
- public TDHPoint transform(TDHPoint punkt) {
- double x1 = (punkt.x * Math.cos(theta)) - (punkt.y * Math.sin(theta));
- double y1 = (punkt.x * Math.sin(theta)) - (punkt.y * Math.cos(theta));
-
- double x2 = (-x0 * Math.cos(theta)) + (y0 * Math.sin(theta)) + x0;
- double y2 = (-x0 * Math.sin(theta)) - (y0 * Math.cos(theta)) + y0;
-
- double x = x1 + (punkt.z * x2);
- double y = y1 + (punkt.z * y2);
-
- return new TDHPoint(x, y, punkt.z);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- long temp;
- temp = Double.doubleToLongBits(x0);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(y0);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- TDHPointRotation other = (TDHPointRotation) obj;
- if (Double.doubleToLongBits(x0) != Double.doubleToLongBits(other.x0))
- return false;
- if (Double.doubleToLongBits(y0) != Double.doubleToLongBits(other.y0))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "TDHPointRotation [x0=" + x0 + ", y0=" + y0 + "]";
- }
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHRotation.java b/CSMath/src/bezier/transforms/geom/TDHRotation.java deleted file mode 100644 index 8870b53..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHRotation.java +++ /dev/null @@ -1,57 +0,0 @@ -package bezier.transforms.geom;
-
-import bezier.geom.TDHPoint;
-
-public class TDHRotation implements TDHTransform {
- public final double theta;
-
- public TDHRotation(double theta) {
- this.theta = theta;
- }
-
- @Override
- public TDHPoint transform(TDHPoint punkt) {
- double x = (punkt.x * Math.cos(theta)) - (punkt.y * Math.sin(theta));
- double y = (punkt.x * Math.sin(theta)) - (punkt.y * Math.cos(theta));
-
- return new TDHPoint(x, y, punkt.z);
- }
-
- public double[][] matrix() {
- return new double[][] { new double[] { Math.cos(theta), Math.sin(theta), 0 },
- new double[] { -Math.sin(theta), Math.cos(theta), 0 }, new double[] { 0, 0, 1 } };
- }
-
- public TDHTransform invert() {
- return new TDHRotation(-theta);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- long temp;
- temp = Double.doubleToLongBits(theta);
- 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;
- TDHRotation other = (TDHRotation) obj;
- if (Double.doubleToLongBits(theta) != Double.doubleToLongBits(other.theta))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "TDHRotation [theta=" + theta + "]";
- }
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHScale.java b/CSMath/src/bezier/transforms/geom/TDHScale.java deleted file mode 100644 index a6db9a9..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHScale.java +++ /dev/null @@ -1,124 +0,0 @@ -package bezier.transforms.geom;
-
-import bezier.geom.TDHPoint;
-
-/**
- * Transform that does coordinate scaling.
- *
- * @author bjculkin
- *
- */
-public class TDHScale implements TDHTransform {
- /**
- * Amount to scale x by.
- */
- public final double sx;
- /**
- * Amount to scale y by.
- */
- public final double sy;
- /**
- * Amount to scale the homogeneous coordinate by.
- */
- public final double sz;
-
- /**
- * Create a new scaling that scales each coordinate by an equal amount
- *
- * @param factor
- * The amount to scale the coordinates by.
- */
- public TDHScale(double factor) {
- this(factor, factor);
- }
-
- /**
- * Create a new scaling that scales each coordinate separately.
- *
- * @param sx
- * The amount to scale x by.
- * @param sy
- * The amount to scale y by.
- */
- public TDHScale(double sx, double sy) {
- this(sx, sy, 1);
- }
-
- /**
- * Create a new scaling that scales each coordinate separately.
- *
- * Includes the homogeneous coordinate.
- *
- * @param sx
- * The amount to scale x by.
- * @param sy
- * The amount to scale y by.
- * @param sz
- * The amount to scale the homogeneous coordinate by.
- */
- public TDHScale(double sx, double sy, double sz) {
- this.sx = sx;
- this.sy = sy;
- this.sz = sz;
- }
-
- @Override
- public TDHTransformType type() {
- return TDHTransformType.SCALE;
- }
-
- @Override
- public TDHPoint transform(TDHPoint punkt) {
- double x = punkt.x * sx;
- double y = punkt.y * sy;
- double z = punkt.z * sz;
-
- return new TDHPoint(x, y, z);
- }
-
- @Override
- public double[][] matrix() {
- return new double[][] { new double[] { sx, 0, 0 }, new double[] { 0, sy, 0 }, new double[] { 0, 0, sz } };
- }
-
- public TDHTransform invert() {
- return new TDHScale(1 / sx, 1 / sy, 1 / sy);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- long temp;
- temp = Double.doubleToLongBits(sx);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(sy);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(sz);
- 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;
- TDHScale other = (TDHScale) obj;
- if (Double.doubleToLongBits(sx) != Double.doubleToLongBits(other.sx))
- return false;
- if (Double.doubleToLongBits(sy) != Double.doubleToLongBits(other.sy))
- return false;
- if (Double.doubleToLongBits(sz) != Double.doubleToLongBits(other.sz))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "TDHScale [sx=" + sx + ", sy=" + sy + ", sz=" + sz + "]";
- }
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHShear.java b/CSMath/src/bezier/transforms/geom/TDHShear.java deleted file mode 100644 index c0c72ca..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHShear.java +++ /dev/null @@ -1,59 +0,0 @@ -package bezier.transforms.geom;
-
-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 diff --git a/CSMath/src/bezier/transforms/geom/TDHTransform.java b/CSMath/src/bezier/transforms/geom/TDHTransform.java deleted file mode 100644 index 20afc53..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHTransform.java +++ /dev/null @@ -1,54 +0,0 @@ -package bezier.transforms.geom;
-
-import bezier.geom.TDHPoint;
-
-/**
- * Transformation applicable to TDHPoints.
- *
- * @author bjculkin
- *
- */
-@FunctionalInterface
-public interface TDHTransform {
- /**
- * Get the type of this transform.
- *
- * Unknown transformations are assumed to be identity transforms.
- *
- * @return The type of this transform.
- */
- default TDHTransformType type() {
- return TDHTransformType.IDENTITY;
- }
-
- /**
- * Get the matrix representation of the transform.
- *
- * Unknown transformations are assumed to be identity transforms.
- *
- * @return The matrix representation of the transform.
- */
- default double[][] matrix() {
- return new double[][] { new double[] { 1, 0, 0 }, new double[] { 0, 1, 0 }, new double[] { 0, 0, 1 } };
- }
-
- /**
- * Get the inverse of the transform.
- *
- * Unknown transformations are assumed to be identity transforms.
- *
- * @return The inverse the transform.
- */
- default TDHTransform invert() {
- return new TDHIdentity();
- }
-
- /**
- * Apply the transform to a point.
- *
- * @param punkt
- * The point to transform.
- * @return A transformed version of the point.
- */
- TDHPoint transform(TDHPoint punkt);
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHTransformType.java b/CSMath/src/bezier/transforms/geom/TDHTransformType.java deleted file mode 100644 index 909afdc..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHTransformType.java +++ /dev/null @@ -1,42 +0,0 @@ -package bezier.transforms.geom;
-
-/**
- * Types of transform to apply to TDHPoints.
- *
- * @author bjculkin
- *
- */
-public enum TDHTransformType {
- /**
- * Coordinate translation.
- */
- TRANSLATE,
- /**
- * Do nothing transform.
- */
- IDENTITY,
- /**
- * Coordinate scaling.
- */
- SCALE,
- /**
- * Coordinate rotation.
- */
- ROTATION,
- /**
- * Coordinate reflection.
- */
- REFLECTION,
- /**
- * Coordinate shearing.
- */
- SHEAR,
- /**
- * Multiple transformations.
- */
- COMBINATION,
- /**
- * Arbitrary matrix transformation.
- */
- MATRIX
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHTranslate.java b/CSMath/src/bezier/transforms/geom/TDHTranslate.java deleted file mode 100644 index 905711f..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHTranslate.java +++ /dev/null @@ -1,89 +0,0 @@ -package bezier.transforms.geom;
-
-import bezier.geom.TDHPoint;
-
-/**
- * A transform that does coordinate translation.
- *
- * @author bjculkin
- *
- */
-public class TDHTranslate implements TDHTransform {
- /**
- * The amount to translate the x-coordinate by.
- */
- public final double h;
- /**
- * The amount to translate the y-coordinate by.
- */
- public final double k;
-
- /**
- * Create a new translation transform.
- *
- * @param h
- * The amount to translate x by.
- * @param k
- * The amount to translate y by.
- */
- public TDHTranslate(double h, double k) {
- this.h = h;
- this.k = k;
- }
-
- @Override
- public TDHTransformType type() {
- return TDHTransformType.TRANSLATE;
- }
-
- @Override
- public TDHPoint transform(TDHPoint punkt) {
- double x = punkt.x + (punkt.z * h);
- double y = punkt.y + (punkt.z * k);
-
- return new TDHPoint(x, y, punkt.z);
- }
-
- @Override
- public double[][] matrix() {
- return new double[][] { new double[] { 1, 0, 0 }, new double[] { 0, 1, 0 }, new double[] { h, k, 1 } };
- }
-
- @Override
- public TDHTransform invert() {
- return new TDHTranslate(-h, -k);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- long temp;
- temp = Double.doubleToLongBits(h);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(k);
- 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;
- TDHTranslate other = (TDHTranslate) obj;
- if (Double.doubleToLongBits(h) != Double.doubleToLongBits(other.h))
- return false;
- if (Double.doubleToLongBits(k) != Double.doubleToLongBits(other.k))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "TDHTranslate [h=" + h + ", k=" + k + "]";
- }
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHXAxisReflection.java b/CSMath/src/bezier/transforms/geom/TDHXAxisReflection.java deleted file mode 100644 index 4b4bffe..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHXAxisReflection.java +++ /dev/null @@ -1,20 +0,0 @@ -package bezier.transforms.geom;
-
-import bezier.geom.TDHPoint;
-
-public class TDHXAxisReflection implements TDHTransform {
- @Override
- public TDHTransformType type() {
- return TDHTransformType.REFLECTION;
- }
-
- @Override
- public TDHPoint transform(TDHPoint punkt) {
- return new TDHPoint(punkt.x, -punkt.y, punkt.z);
- }
-
- @Override
- public String toString() {
- return "TDHXAxisReflection []";
- }
-}
\ No newline at end of file diff --git a/CSMath/src/bezier/transforms/geom/TDHYAxisReflection.java b/CSMath/src/bezier/transforms/geom/TDHYAxisReflection.java deleted file mode 100644 index 39e9f18..0000000 --- a/CSMath/src/bezier/transforms/geom/TDHYAxisReflection.java +++ /dev/null @@ -1,20 +0,0 @@ -package bezier.transforms.geom;
-
-import bezier.geom.TDHPoint;
-
-public class TDHYAxisReflection implements TDHTransform {
- @Override
- public TDHTransformType type() {
- return TDHTransformType.REFLECTION;
- }
-
- @Override
- public TDHPoint transform(TDHPoint punkt) {
- return new TDHPoint(-punkt.x, punkt.y, punkt.z);
- }
-
- @Override
- public String toString() {
- return "TDHYAxisReflection []";
- }
-}
\ No newline at end of file |
