2 * Sixth 3D engine. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
5 package eu.svjatoslav.sixth.e3d.math;
7 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
9 public class Transform implements Cloneable {
11 private final Point3D translation;
12 private final Orientation orientation;
15 translation = new Point3D();
16 orientation = new Orientation();
20 * Creates a new transform with the specified translation.
25 public Transform(final Point3D translation) {
26 this.translation = translation;
27 orientation = new Orientation();
31 * Creates a new transform with the specified translation and orientation.
36 * the angle around the XZ axis
38 * the angle around the YZ axis
40 public Transform(final Point3D translation, final double angleXZ,
41 final double angleYZ) {
43 this.translation = translation;
44 orientation = new Orientation(angleXZ, angleYZ);
48 * Creates a new transform with the specified translation and orientation.
55 public Transform(final Point3D translation, final Orientation orientation) {
56 this.translation = translation;
57 this.orientation = orientation;
61 public Transform clone() {
62 return new Transform(translation, orientation);
65 public Orientation getOrientation() {
69 public Point3D getTranslation() {
73 public void transform(final Point3D point) {
74 orientation.rotate(point);
75 point.add(translation);