Regalamiunsorriso/decompiled-libs/www/acxent-face-1.0.0/it/acxent/face/Point.java

71 lines
1.5 KiB
Java

package it.acxent.face;
import it.acxent.util.DoubleOperator;
public class Point {
private long x;
private long y;
private long z;
public Point(long x, long y) {
this.x = x;
this.y = y;
this.z = 0L;
}
public Point(long x, long y, long z) {
this.x = x;
this.y = y;
this.z = z;
}
public Point() {}
public long getX() {
return this.x;
}
public void setX(long x) {
this.x = x;
}
public long getY() {
return this.y;
}
public void setY(long y) {
this.y = y;
}
public long getZ() {
return this.z;
}
public void setZ(long z) {
this.z = z;
}
public static final double getDistance(Point start, Point end) {
double d1 = Math.sqrt(Math.pow((double)(end.getX() - start.getX()), 2.0D) + Math.pow((double)(end.getY() - start.getY()), 2.0D) +
Math.pow((double)(end.getZ() - start.getZ()), 2.0D));
return d1;
}
public static final double getDistanceNorm(Point start, Point end, double scaleFactor) {
DoubleOperator dop = new DoubleOperator(scaleFactor);
dop.multiply(getDistance(start, end));
return dop.getResult();
}
public static final float getDistanceNormF(Point start, Point end, double scaleFactor) {
return (float)getDistanceNorm(start, end, scaleFactor);
}
public static void main(String[] args) {
Point a = new Point(0L, 0L, 0L);
Point b = new Point(2L, 2L, 0L);
System.out.println(getDistance(a, b));
}
}