diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-05-23 16:42:38 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-05-23 16:42:38 -0400 |
| commit | 48f781fb6e61539ba9d17efcfd9f9e38245cf6c0 (patch) | |
| tree | 97e5743678a00d09024ec040490b8fcf8ccb1c74 /CSMath/src/bezier/transforms/TDHScale.java | |
| parent | 81d8191c01629d881486f1f1fe5ae16c42b46287 (diff) | |
Refactor package structure
Diffstat (limited to 'CSMath/src/bezier/transforms/TDHScale.java')
| -rw-r--r-- | CSMath/src/bezier/transforms/TDHScale.java | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/CSMath/src/bezier/transforms/TDHScale.java b/CSMath/src/bezier/transforms/TDHScale.java deleted file mode 100644 index 5cfd300..0000000 --- a/CSMath/src/bezier/transforms/TDHScale.java +++ /dev/null @@ -1,124 +0,0 @@ -package bezier.transforms;
-
-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 |
