X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fmath%2FTransform.java;h=90015b7c64bee25570bcb8755617bf84dac56884;hb=HEAD;hp=68eeae59d24b3b58dff8dcfb5fa4057a442cf4f1;hpb=59baa428fb2d9e7f0fe5423f4cea47f2d6245914;p=sixth-3d.git diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java b/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java index 68eeae5..90015b7 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java @@ -1,19 +1,25 @@ /* - * Sixth 3D engine. Copyright ©2012-2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.math; import eu.svjatoslav.sixth.e3d.geometry.Point3D; +/** + * Used to represent transformation in a 3D space. + * Transformations are represented as a translation and an {@link Orientation}. + */ public class Transform implements Cloneable { + /** + * The translation is applied after the orientation. + */ private final Point3D translation; + + /** + * The orientation is applied before the translation. + */ private final Orientation orientation; public Transform() { @@ -21,11 +27,23 @@ public class Transform implements Cloneable { orientation = new Orientation(); } + /** + * Creates a new transform with the specified translation. + * + * @param translation the translation + */ public Transform(final Point3D translation) { this.translation = translation; orientation = new Orientation(); } + /** + * Creates a new transform with the specified translation and orientation. + * + * @param translation the translation + * @param angleXZ the angle around the XZ axis + * @param angleYZ the angle around the YZ axis + */ public Transform(final Point3D translation, final double angleXZ, final double angleYZ) { @@ -33,6 +51,12 @@ public class Transform implements Cloneable { orientation = new Orientation(angleXZ, angleYZ); } + /** + * Creates a new transform with the specified translation and orientation. + * + * @param translation the translation + * @param orientation the orientation + */ public Transform(final Point3D translation, final Orientation orientation) { this.translation = translation; this.orientation = orientation; @@ -51,6 +75,11 @@ public class Transform implements Cloneable { return translation; } + /** + * Applies this transform to the specified point in a 3D space. + * + * @param point to apply this transform to + */ public void transform(final Point3D point) { orientation.rotate(point); point.add(translation);