+++ /dev/null
-/*
- * Sixth 3D engine. Copyright ©2012-2018, 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.
- *
- */
-
-
-package eu.svjatoslav.sixth.e3d.geometry;
-
-public class Orientation implements Cloneable {
-
- private double s1, c1, s2, c2;
-
- private double angleXZ = 0;
- private double angleYZ = 0;
-
- public Orientation() {
- computeMultipliers();
- }
-
- public Orientation(final double angleXZ, final double angleYZ) {
- this.angleXZ = angleXZ;
- this.angleYZ = angleYZ;
- computeMultipliers();
- }
-
- @Override
- public Orientation clone() {
- return new Orientation(angleXZ, angleYZ);
- }
-
- private void computeMultipliers() {
- s1 = Math.sin(angleXZ);
- c1 = Math.cos(angleXZ);
-
- s2 = Math.sin(angleYZ);
- c2 = Math.cos(angleYZ);
- }
-
- public void rotate(final Point3D point3d) {
- final double z1 = (point3d.z * c1) - (point3d.x * s1);
- point3d.x = (point3d.z * s1) + (point3d.x * c1);
-
- point3d.z = (z1 * c2) - (point3d.y * s2);
- point3d.y = (z1 * s2) + (point3d.y * c2);
- }
-
- public void rotate(final double angleXZ, final double angleYZ) {
- this.angleXZ += angleXZ;
- this.angleYZ += angleYZ;
- computeMultipliers();
- }
-
-}