oop-labs-collection/labs/3/renderSuite/Util.java

18 lines
473 B
Java

package renderSuite;
import java.lang.Math;
import renderSuite.Vec3;
public class Util {
// measure distance between two points
public static double d(Vec3 p1, Vec3 p2) {
return Math.sqrt((p1.x - p2.x) * (p1.x - p2.x)
+ (p1.y - p2.y) * (p1.y - p2.y)
+ (p1.z - p2.z) * (p1.z - p2.z));
}
public static double dot(Vec3 v1, Vec3 v2) {
return Math.sqrt(v1.x*v2.x + v1.y*v2.y + v1.z*v2.z);
}
}