trackeditor: add some functions to Point3D

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9298 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
iobyte 2024-02-01 23:10:45 +00:00
parent e70913a990
commit bfaaf6e39b
2 changed files with 38 additions and 5 deletions

View File

@ -34,7 +34,7 @@ public class Properties
private static Properties instance = new Properties();
private Vector<ActionListener> propertiesListeners = new Vector<ActionListener>();
public final String title = "sd2-trackeditor";
public final String version = "1.4.25";
public final String version = "1.4.26";
private String path;
private double imageScale = 1;

View File

@ -17,8 +17,41 @@ public class Point3D extends Point2D.Double
this.z = z;
}
public String toString()
{
return "Point3D["+x+", "+y+", "+z+"]";
}
public void set(double x, double y, double z)
{
this.x = x;
this.y = y;
this.z = z;
}
public void sub(Point3D p0, Point3D p1)
{
x = p0.x - p1.x;
y = p0.y - p1.y;
z = p0.z - p1.z;
}
public void cross(Point3D p0, Point3D p1)
{
x = -p0.z * p1.y + p0.y * p1.z;
y = p0.z * p1.x - p0.x * p1.z;
z = -p0.y * p1.x + p0.x * p1.y;
}
public double dot(Point3D p)
{
return x * p.x + y * p.y + z * p.z;
}
public void scaleAdd(double scale, Point3D p0, Point3D p1)
{
x = scale * p0.x + p1.x;
y = scale * p0.y + p1.y;
z = scale * p0.z + p1.z;
}
public String toString()
{
return "Point3D["+x+", "+y+", "+z+"]";
}
}